Solved

AD Bulk set User to Exchange Powershell 2007

Posted on 2016-10-20
9
44 Views
Last Modified: 2016-10-26
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.
0
Comment
Question by:Jorge Ocampo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 10

Expert Comment

by:Muhammad Mulla
ID: 41852259
Are you doing this with the AD modules imported into Powershell? Try:

Import-Module ActiveDirectory

Open in new window

0
 
LVL 16

Expert Comment

by:Todd Nelson
ID: 41852266
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.
0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 41852306
import is on if i do a set-aduser to one user the command goes through
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 16

Expert Comment

by:Todd Nelson
ID: 41852331
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.

Import-csv C:\Temp\input.csv | ForEach-Object {Set-ADUser $_.User -Office $_.Office -StreetAddress $_.StreetAddress -City $_.City -state $_.state -postalcode $_.postalcode}

Open in new window

0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 41852338
the following fields in csv user,office,streetaddress,city,state,postalcode
0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 41852339
ill try replacing and see
0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 41852358
no go would it possible to re-rewrite command for exchange powershell command instead could be because powershell 2.0 is not compatible
0
 
LVL 16

Expert Comment

by:Todd Nelson
ID: 41852373
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.
0
 
LVL 13

Accepted Solution

by:
Guy Lidbetter earned 500 total points
ID: 41853545
@Todd: "%" is the alias for Foreach...

@Jorge: - Please give this rewrite a shot...

Import-Module ActiveDirectory
$Userlist = Import-csv C:\Temp\input.csv
Foreach ($User in $Userlist) {
	Set-ADUser $User.User -Office $User.Office -StreetAddress $User.StreetAddress -City $User.City -state $User.state -postalcode $User.postalcode
}

Open in new window

0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
Let's recap what we learned from yesterday's Skyport Systems webinar.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question