Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Exchange disable account script.

Posted on 2011-09-26
7
Medium Priority
?
283 Views
Last Modified: 2012-05-12
Hi All, I have an 2007 exchange server and i need to disable over 400 accounts. I have a list of usernames in CSV so will need the script the look at the alias then disable the account.....Has anyone got a script for this?
0
Comment
Question by:IT-Darlo
[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
  • 5
  • 2
7 Comments
 
LVL 10

Expert Comment

by:ienaxxx
ID: 36599997
What do you want to do, to disable just the mailbox or the whole user in AD?
0
 

Author Comment

by:IT-Darlo
ID: 36708214
Just disable the mailbox please mate. In AD the user needs to remain active.
0
 
LVL 10

Accepted Solution

by:
ienaxxx earned 2000 total points
ID: 36708264
OK,
Given a CSV format like this:

"Alias","Hits","Size"
"JohnDoe","78173","163625808"
"PincoPall","24626","-1789110063"
"LucyRoss","17204","1959963618"
"FrankScaglione","15796","-55874279"

in csvList.csv

You can use:

import-csv csvList.csv | Select Alias | disable-mailbox


OBVIOUSLY: First try with a CSV of ONE entry of a test user. Then, if evthng's ok, give it a go.


HTH
Bye!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:IT-Darlo
ID: 36708815
Sorry to sound really stupid here......But i dont need the hits or size do i?
0
 
LVL 10

Expert Comment

by:ienaxxx
ID: 36709179
No, it was just to contemplate the case in which your list has more than a column.

If you have full list of aliases (on one row) separated by a comma, you should use something else. is that the case?
0
 
LVL 10

Expert Comment

by:ienaxxx
ID: 36709250
for example you should use something like that:

$a=get-content CsvList.csv
Foreach-Object -Inputobject $a.split(",") -process disable-mailbox $_

always test it with a single or a couple of test aliases.
HTH, bye!
0
 
LVL 10

Expert Comment

by:ienaxxx
ID: 36709723
Better:

limit the output of a given number of lines from CsvList.csvwith with

$a=get-content CsvList.csv -totalcount 1

HTH
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Mailbox Overload?
Changing a few Outlook Options can help keep you organized!
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

721 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