|
I got this far with this problem on my own. I have browsed the board, I have read the manuals. I am just stumped, the only problem I have with the script below is on the lines with "--" at the begining I get the error "IDispatch pointers not allowed in expressions!"
Can anyone help me?
$sContainer="OU=someou,OU=someotherou" $id="testpc" $desc="test" $groupadd="domain\name"
$adsDomain = GetObject("LDAP://" + $sContainer + ",dc=domain,dc=com") $adsComputer = $adsDomain.Create("computer","cn=" + $id)
$adsComputer.ComputerID="$id" $adsComputer.Description="$desc"
$descriptor=$adsComputer.Get("ntSecurityDescriptor") $dACL = $descriptor.DiscretionaryAcl $ace = CreateObject("AccessControlEntry") $ace.AccessMask=-1 $ace.AceType = 0 $ace.AceFlags =2 $ace.trustee = $groupadd $dACL.AddAce $ace --$descriptor.DiscretionaryAcl = $dACL --$adsComputer.Put "ntSecurityDescriptor", Array($descriptor) $adsComputer.SetInfo
|