DaveWentzel.com            All Things Data

COM Support

The new-object cmdlet with the ComObject parameter allows you to create a new COM object from a .NET object that can be manipulated however you like.  I am mostly familiar with COM and vbscript so this is very familiar for me.  These WSH objects are especially useful, although their functionality is implemented elsewhere. 
 
$Wsh = new-object -ComObject WScript.Shell
$Wsh = new-object -ComObject WScript.Network
$Wsh = new-object -ComObject Scripting.Dictionary
$Wsh = new-object -ComObject Scripting.FileSystemObject
 
$Wsh | Get-Member
Get-Member -InputObject $Wsh
 
ADO
$global:objConn = new-object -ComObject ADODB.Connection
 
CDO
It appears as though CDO COM Objects are not supported in PS.  I can't get them to work and can't find any documentation. 
 

Add new comment