Specify a server during an [ADSI] command
function get-adobjectou { # ---------------------------------------------------------------------------------------------- # function outputs objects containing ou # - requires distinguished name input # - outputs containing ou # ---------------------------------------------------------------------------------------------- param ( [parameter(mandatory=$true, valuefrompipelinebypropertyname=$true)][alias("dn")][string]$distinguishedname ) $ou = ([adsi]"ldap://$distinguishedname").parent -replace 'ldap://' if( $ou.length -eq 0 ) { write-host -foregroundcolor red "error: parent ou cannot found because distinguishedname not exist." break } else { $ou } } # end get-adobjectou i making several changes before use "-server dc.mydomain.com" , replication not have controllers date for a few seconds. want sure using same dc used make changes prior command.
how can specify server use in above example?
find post helpful? post answer question? sure mark appropriately others find answers searches.
search friend:
Windows Server > Windows PowerShell
Comments
Post a Comment