robertarenson
asked on
PowerShell Setting of Home Directory Issues
I am trying to take my script that works just fine for individual AD User Accounts and get it to read from a text file a list of
AD user names and then update their Home Directory within Profile HomeFolder.
Thanks again for the help
Script that works for individual AD User Accounts:
Set-ADUser -identity "UserName" -homeDrive h: -homeDir "\\ServerName\HOME"
Script that is not working properly:
Set-ADUser -identity ((Get-Content users.txt) -replace '$', '$') -homeDrive h: -homeDir "\\ServerName\HOME"
Error Msg:
Set-ADUser : Cannot find an object with identity: 'MedreconTest$' under:
'DC=test,DC=com'.
At C:\disabledshares\SetHomeD rive1.ps1: 1 char:1
+ Set-ADUser -identity ((Get-Content users.txt) -replace '$', '$') -homeDrive
h: - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
~~~
+ CategoryInfo : ObjectNotFound: (MedreconTest$:ADUser) [Set-ADUs
er], ADIdentityNotFoundExceptio n
+ FullyQualifiedErrorId : Cannot find an object with identity: 'MedreconTe
st$' under: 'DC=whhs,DC=local'.,Micros oft.Active Directory. Management .Comma
nds.SetADUser
AD user names and then update their Home Directory within Profile HomeFolder.
Thanks again for the help
Script that works for individual AD User Accounts:
Set-ADUser -identity "UserName" -homeDrive h: -homeDir "\\ServerName\HOME"
Script that is not working properly:
Set-ADUser -identity ((Get-Content users.txt) -replace '$', '$') -homeDrive h: -homeDir "\\ServerName\HOME"
Error Msg:
Set-ADUser : Cannot find an object with identity: 'MedreconTest$' under:
'DC=test,DC=com'.
At C:\disabledshares\SetHomeD
+ Set-ADUser -identity ((Get-Content users.txt) -replace '$', '$') -homeDrive
h: - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : ObjectNotFound: (MedreconTest$:ADUser) [Set-ADUs
er], ADIdentityNotFoundExceptio
+ FullyQualifiedErrorId : Cannot find an object with identity: 'MedreconTe
st$' under: 'DC=whhs,DC=local'.,Micros
nds.SetADUser
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to help
ASKER