I have a PowerShell script that creates a HomeDrive, HomeDirectory, and
adds a default AD Group when a new user is created via our AD Driver. It
works sometimes and sometimes it fails with the following error:


Code:
--------------------
<status event-id="b84b0fb22bc1" level="error" text1="Exchange 2010" type="powershell">Exchange 2010 Exception. code:0x000000ae Error completing exchange 2010 command. ERROR: Cannot find an object with identity: 'testuser1' under: 'DC=health-quest,DC=org'.</status>
--------------------


Any one have any ideas as to why this is failing sporadically?


Code:
--------------------
<add-attr attr-name="PSExecute">
<value type="string">New-Item -Type Directory -Path \\share\users\testuser1
Set-ADUser -HomeDrive P: -HomeDirectory \\share\users\testuser1 -Identity testuser1
Add-ADGroupMember -Identity 'CN=All VBMC Users,CN=Users,DC=health-quest,DC=org' -Member testuser1
$Acl = Get-Acl \\share\users\testuser1
$Acl.SetAccessRuleProtection($True, $True)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule ("testuser1","Modify, Synchronize", "ContainerInherit, ObjectInherit", "None", "Allow")
$Acl.AddAccessRule($Ar)
Set-Acl \\share\users\testuser1 $Acl
</value>
</add-attr>
--------------------


--
triciabowen
------------------------------------------------------------------------
triciabowen's Profile: https://forums.netiq.com/member.php?userid=542
View this thread: https://forums.netiq.com/showthread.php?t=52682