Need to set OOO using Powershell scrip for Multiple users
Hi,
I need to create a script to set out of office for multiple users ID with the help of Powershell script, i know the comand but i am not getting any idea how to make script which reads username.txt and set OOO.
June 4th, 2012 1:49am
Hi,
The following script can be useful for your scenario. You have to seperate each user by adding double codes seperated by comma.
$Users = Get-Content C:\Scripts\Test.txt
$(foreach ($User in $Users) {
Set-MailboxAutoReplyConfiguration $User AutoReplyState Scheduled StartTime 6/4/2012 EndTime 6/5/2012 ExternalMessage Out of office testing InternalMessage Out of office testing..
})Vijay Ramshetty
Free Windows Admin Tool Kit Click here and download it now
June 4th, 2012 8:02am
Vijay, I am wondering - what is the purpose of the
$(
in the first line, and the closing
)
in the last? Your script works, and I think its the best answer here, but because the code seems to work without this formatting, I'm wondering what it does?
Mike Crowley | MVP
My Blog --
Planet Technologies
June 4th, 2012 9:58pm
Here is my cmdlet.
$user=import-csv d:\username.txt | %{set-mailboxautoreplyconfiguration -identity $_.alias -autoreplystate Scheduled -starttime "6/5/2012" -endtime "6/6/2012" -internalmessage "OOF test"}
Note: I just have one row named "Alias" in the username.txt file.Jack Zhou - MSFT
Free Windows Admin Tool Kit Click here and download it now
June 4th, 2012 10:20pm
Here is my cmdlet.
$user=import-csv d:\username.txt | %{set-mailboxautoreplyconfiguration -identity $_.alias -autoreplystate Scheduled -starttime "6/5/2012" -endtime "6/6/2012" -internalmessage "OOF test"}
Note: I just have one row named "Alias" in the username.txt file.Jack Zhou - MSFT
June 4th, 2012 10:22pm
Thanks Mike,
That is my typo mistake. Yes are you right. It works without inserting open and closed brackets.Vijay Ramshetty
Free Windows Admin Tool Kit Click here and download it now
June 4th, 2012 11:50pm