I converted a VBScript to a Powershell instead. This is one of my many problems that I encountered:
Method invocation failed because [ADODB.CommandClass] doesn't contain a method named 'Properties'.
Code Below:
$objConnection = new-Object -com "ADODB.Connection"
$objCommand = new-Object -com "ADODB.Command"
$objConnection.Provider = "ADsDSOObject"
$objConnection.Open( "Active Directory Provider")
$objCommand.ActiveConnection = $objConnection
$objCommand.CommandText = "Select Name From '" + $ADSPath + "' where " + $SearchField + " = '" + $SearchValue + "'"
$objCommand.Properties("Chase referrals") = ADS_CHASE_REFERRALS_EXTERNAL
The problem might be because of the ADS_CHASE_REFERRALS_EXTERNAL only working for VB. Any solution or the proper way to do this in Powershell?