I want to use a PS script in TS. The script should move the current client to a Special OU in AD.
The script is working but, I am having a Problem calling it in a TS. I have to run the script with an domain account which is ahving the rights to move the Client.
Here is the script. Ist working outside the TS:
# Retrieve DN of local computer.
$SysInfo = New-Object -ComObject "ADSystemInfo"
$ComputerDN = $SysInfo.GetType().InvokeMember("ComputerName", "GetProperty", $Null, $SysInfo, $Null)
# Bind to computer object in AD.
$Computer = [ADSI]"LDAP://$ComputerDN"
# Specify target OU.
$TargetOU = "ou=_clients,dc=mydomain,dc=int"
# Bind to target OU.
$OU = [ADSI]"LDAP://$TargetOU"
# Move computer to target OU.
$Computer.psbase.MoveTo($OU)


