Solved

Exchange disable account script.

Posted on 2011-09-26
7
273 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
  • 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 500 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

776 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