Script disable-mailbox help
Hi all, Exchnage 2007 SP2 I need to run Disable-Mailbox -Identity logon@mycompany.local -confirm:$false for about 800 users. I do have txt file which includes all logon accounts in this format logon1@mycompany.local logon2@mycompany.local logon3@mycompany.local ..... Is there a way to run the powershell script based on this file instead of I have to make 800 lines for Disable-Mailbox -Identity logon@mycompany.local -confirm:$false Disable-Mailbox -Identity logon1@mycompany.local -confirm:$false ..... Thank you for your help.
November 17th, 2010 9:33am

Hi, It should look something like this is you have a CSV that resembles this: logon, logon@mycompany.local Then you can powershell the disable like this: import-csv users.csv | foreach { disable-mailbox -identity $_.logon -confirm:$false } /Martin Exchange is a passion not just a collaboration software.
Free Windows Admin Tool Kit Click here and download it now
November 17th, 2010 9:49am

If it's just a plain text list of addresses, you can just use get-content on the file. get-content list.txt | foreach-object { disable-mailbox -identity $_ -confirm:$false } [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
November 17th, 2010 9:55am

You are life saver. Thank you.
Free Windows Admin Tool Kit Click here and download it now
November 17th, 2010 11:11am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics