powershell passing variables
i'm trying to modfy, in bulk, users to change their mailbox features. whenever i try this i get an error,
Import-CSV "C:\emails2.csv" | foreach { Set-CASMailbox -identity $_ -OWAEnabled $true}
but when i try this,
Import-CSV "C:\emails2.csv" | foreach { $_ }
it outputs on the screen the contents of the CSV file. so this suggests that the value of $_ survives the pipe command. what am i doing wrong in the first command that it fails?
December 3rd, 2012 6:20am
You may like to try $_.<column header in CSV>
Free Windows Admin Tool Kit Click here and download it now
December 3rd, 2012 10:28am
You may like to try $_.<column header in CSV>
December 3rd, 2012 6:20pm
Hi Rino,
Any updates?
Li is right. For example, if your csv file format is:
mailboxname
user1
user2
...
Please try:
-identity $_.mailboxname
If you have any feedback on our support, please click
here
Frank Wang
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
December 4th, 2012 3:24am
hi. thanks for the replies. will try them when i get back to office.
December 4th, 2012 3:59am