Deactivate users from CSV
Hello, I am Exchange 2007 and I wanna deactivate users from a csv file. The script works fine but I am ask to answer the below question: Confirm Are you sure you want to perform this action? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Find also the script I use: Get-Content "C:\DEACTIVATE.csv" | Disable-Mailbox Would it be possible to Answer [A] Yes to All in the script?? Thanks in advance for your help. G
July 8th, 2010 3:18pm

Hello, I am Exchange 2007 and I wanna deactivate users from a csv file. The script works fine but I am ask to answer the below question: Confirm Are you sure you want to perform this action? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Find also the script I use: Get-Content "C:\DEACTIVATE.csv" | Disable-Mailbox Would it be possible to Answer [A] Yes to All in the script?? Thanks in advance for your help. G Yes, try this Get-Content "C:\DEACTIVATE.csv" | Disable-Mailbox -Confirm:$false Regards, Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2010 3:20pm

forgot to ask that I would need to deactivated both Mailbox and Mailuser. How could I disable the 2 type of mailbox/user?
July 8th, 2010 3:22pm

forgot to ask that I would need to deactivated both Mailbox and Mailuser. How could I disable the 2 type of mailbox/user? You can put the mail users in a file like u did above and then can run this command. Get-Content "C:\DEACTIVATE_MAILUsers.csv" | Disable-MailUser -Confirm:$false Regards,Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2010 3:29pm

1)Would that be possible to combine the 2 mailuser and mailbox though? 2) or as I will use a *.ps1 I could do: PS1 content : $AdminSessionADSettings.ViewEntireForest = $true Get-Content "C:\DEACTIVATE.csv" | Disable-Mailbox -Confirm:$false Get-Content "C:\DEACTIVATE.csv" | Disable-Mailbox -Confirm:$false
July 8th, 2010 3:34pm

1)Would that be possible to combine the 2 mailuser and mailbox though? 2) or as I will use a *.ps1 I could do: PS1 content : $AdminSessionADSettings.ViewEntireForest = $true Get-Content "C:\DEACTIVATE.csv" | Disable-Mailbox -Confirm:$false Get-Content "C:\DEACTIVATE.csv" | Disable-Mailbox -Confirm:$false There is one way that you can do this task for mailbox and mail user using one csv file. Your csv "Deactivate.csv" should look like this Mailbox,Mailuser mailboxIdentity1, MailUserIdentity1 mailboxIdentity2, MailUserIdentity2 and then Import-CSV "C:\DEACTIVATE.csv" | forEach{ Disable-Mailbox $_.Malbox -Confirm:$false Disable-MailUser $_.MalUser -Confirm:$false } OR as i suggested in my last post that put mailboxes in one .csv file and mail users in other .csv file and then run the commands for both separately like this $AdminSessionADSettings.ViewEntireForest = $true Get-Content "C:\DEACTIVATE_MAILBOXES.csv" | Disable-Mailbox -Confirm:$false Get-Content "C:\DEACTIVATE_MAILUSERS.csv" | Disable-MailUser -Confirm:$false hope this help u Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2010 3:53pm

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

Other recent topics Other recent topics