Category Powershell

get-wmiobject returns object not found

If you run get-wmiobject and it returns an error that says Object not found. Here’s how to fix it:   For Server 2003: rundll32 wbemupgd, RepairWMISetup For Server 2008: winmgmt /verifyrepository If this doesn’t work, try renaming or deleting the repository: First, you need to stop the WIN Management service net stop winmgmt Then, rename […]

Listing Windows Updates using Powershell

From Listing Windows Updates There is a not widely known COM object that you can use to list all the installed Windows Updates on a machine. Here is the code: $Session = New-Object -ComObject Microsoft.Update.Session $Searcher = $Session.CreateUpdateSearcher() $HistoryCount = $Searcher.GetTotalHistoryCount() $Searcher.QueryHistory(1,$HistoryCount) |   Select-Object Date, Title, Description

Searching for text in text files or Powershell Grepping

Ask any linux admin and they’ll tell you how useful grep is. Grep is a command in linux allow you go search through piped outputs and/or files for certain strings. Grep also allows for the use for regular expression to search for more complex criterias. For a long time Microsoft users have not have such […]

Making AD accounts in an OU “mail-enabled” using powershell

Exchange 2007 If you have a number of users in an OU that are not mail-enabled. You can use the following command to look for all users in a specific OU and then make them mail-enabled: Get-User -OrganizationalUnit “” | Enable-Mailbox -Database “PNLAB storage group\mailbox database” Explaination: Get-User -OrganizationalUnit “” | lists all users in the […]

Monitoring & Notifying Status of Exchange Services using Powershell

For those who have more then one exchange servers, i.e. Edge – Hub/Mailbox, you can use this script to monitor exchange services and if any of the services crashes and doesn’t come up this can help monitor and send notification via emails. Next week I will blog about a similar script that allows for remote monitoring […]

Mass creating users using PowerShell and PowerGUI from Quest

DISCLAIMER: Use on your own risk. My company and I will not be responsible any actions and/or results this script may cause. All user names are fictious. This script can be used to create multiple users using powershell along with PowerGUI from Quest with Active Directory module installed. To use this script, first create a csv file using […]

Hiding Contacts from Global Address List using Exchange Powershell

Ever want to hide a contact or a selected number of contacts from the Global Address List so that users can’t see them when they open Outlook Address Book? In Exchange 2007 you can do this by using the powershell. See below: # Setting up log file Add-Content C:\log\hidelegacycontacts.log “::Starting to hide legacy contacts “; # Setting up […]