Jorge Ocampo
asked on
AD Bulk set User to Exchange Powershell 2007
Hi i am having problems running this script on powershell version
Name Value
---- -----
CLRVersion 2.0.50727.5485
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
Import-csv C:\Temp\input.csv | % {Set-ADUser $_.User -Office $_.Office -StreetAddress $_.StreetAddress -City $_.City -state $_.state -postalcode $_.postalcode}
i had no problem running on my machine but when i do it on the server no error it just doesnt write the values i would like to do the change in exchange powershell 2007 instead.
Name Value
---- -----
CLRVersion 2.0.50727.5485
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
Import-csv C:\Temp\input.csv | % {Set-ADUser $_.User -Office $_.Office -StreetAddress $_.StreetAddress -City $_.City -state $_.state -postalcode $_.postalcode}
i had no problem running on my machine but when i do it on the server no error it just doesnt write the values i would like to do the change in exchange powershell 2007 instead.
What type of server are you running the command from? If the server does not have RSAT or ADDS features installed, the command won't do anything.
Remember to always precede your command with "Import-Module ActiveDirectory" in PowerShell.
Remember to always precede your command with "Import-Module ActiveDirectory" in PowerShell.
ASKER
import is on if i do a set-aduser to one user the command goes through
You command does not look correct. Assuming there is more than one name in the CSV file, how does this command loop for each name?
Replace "%" with "ForEach-Object" and it should run fine.
Replace "%" with "ForEach-Object" and it should run fine.
Import-csv C:\Temp\input.csv | ForEach-Object {Set-ADUser $_.User -Office $_.Office -StreetAddress $_.StreetAddress -City $_.City -state $_.state -postalcode $_.postalcode}
ASKER
the following fields in csv user,office,streetaddress, city,state ,postalcod e
ASKER
ill try replacing and see
ASKER
no go would it possible to re-rewrite command for exchange powershell command instead could be because powershell 2.0 is not compatible
PowerShell 2.0 is not compatible? Provide the error you are getting.
Does it run in PowerShell instead of the Exchange Management Shell?
I have no issues running the command I provided in PowerShell or the Exchange management shell.
Does it run in PowerShell instead of the Exchange Management Shell?
I have no issues running the command I provided in PowerShell or the Exchange management shell.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window