Tuesday, March 27, 2012

Desktop Explorer Tool based on PowerShell.


If you are IT admin like me and supporting remote users, the main problem comes when you are troubleshooting with them. Like ask them to open "Network Connections", open "Start-Up" folders.

to solve these kind of basic problem i wrote a PowerShell GUI script which is based on WPF.  I named this script as "Gobind". This is a version one of the script and i am working on Version 2 of the script which i will upload soon.

Just copy and paste this script on every user and write a batch files to call it or create a shortcut of it on every users Desktop. All Done.

You can download the script from here : http://gallery.technet.microsoft.com/scriptcenter/Desktop-Management-Tool-4b8ca235


This script is using special folders and just exploring them :).
Aman Dhally

Monday, March 26, 2012

PowerShell & SCOM: Use Operations Manager Shell to close multiple Alerts generated by Same Rule

When today i login in to my SCOM console I saw approx 134 Active Alerts about Microsoft SQL Job failure. I was about to close these alert but then one thing strike in my mind that lets try to close these alerts using “Operations Manager Shell”. These Alerts are generating from same source and the name of the alert is same to it would not be to hard. So let try.
Our First Step is to find out the Command which can show us Alert in SCOM Shell.
Open “Operations manager shell” and type  Get-Command *alert* , this will search for all SCOM cmdlets which have the word alert (we use wildcard *), and as you know PowerShell cmdlets works on Verb-Noun format  so if we use Get-Alert cmdlets it will shows all alerts.
Let Try Get-Alert
Type get-alert in the shell and hit Enter and it shown you all alerts.
Next task is to choose which Alert to Close .. if you look at active Alert in SCOM CONSOLE name of My Alert is “"A SQL job failed to complete successfully"
Now our next step is to find the properties and methods supported by Get-Alertcommand. To know these we need to use another command Get-Member
Yes.. it has name property…Gr8
Now we need to see all alerts whose name match “"A SQL job failed to complete successfully", for filter the output from Get-alert command we pipe (|) the output of Get-Alert command to Where-Object cmdlet.
Get-alert | Where-Object { $_.Name -match "A SQL job failed to complete successfully"}
This will show all alerts whose name matches with "A SQL job failed to complete successfully"
So now our next step is to find a cmdlet which can close these alerts. lets find out..  run the same command
Get-Command *alert*
So this time we have find Resolve-Alert cmdlet. now we need to join and our cmdlets command using piping . so this should be like this.
get-alert | where-object { $_.Name -match "A SQL job failed to complete successfully"} | Resolve-alert
in Get Alert we are searching for an Alerts | then we are filter then using Name with match to “Sql job Failure | and then we are resolving them.  now type the above command and hit enter. It will take sometime to do this.
When you command run successfully, open SCOM Console and search for same SQL JOB error and you will found nothing :)

I hope that it helps someone…
Aman Dhally

Monday, March 19, 2012

Get an Average Ping Response time of multiple Servers using PowerShell.


If you are an IT admin, then I am sure you are using PING command everyday. In PowerShell we have an Test-Connection command which is a very good alternative of it. as we know PowerShell is an object based scripting language by using it we can do much more.

Whenever I/we have network or internet related issues we do "Ping google.com" to check the response time of website and then we can know how our internet is performing. Sometime rather then pinging one  website we do ping few more website.

So i was thinking that if i can ping multiple servers in one time and get there average as as result. I don't want an fancy script just a simple script which i can run from my PowerShell console and view the result there.

So i just create a simple PowerShell script which can do this for us.

You can download the script from here : http://gallery.technet.microsoft.com/scriptcenter/Get-the-Average-Ping-49fc4924

$CompName = "dc-Local","google.com","rediff.com","yahoo.com"
foreach ($comp in $CompName) {
       $test = (Test-Connection -ComputerName $comp -Count 4  | measure-Object -Property ResponseTime -Average).average
       $response = ($test -as [int] )
       write-Host "The Average response time for" -ForegroundColor Green -NoNewline;write-Host " `"$comp`" is " -ForegroundColor Red -NoNewline;;Write-Host "$response ms" -ForegroundColor Black -BackgroundColor white
19-03-2012 14-05-36 

Aman Dhally

Monday, March 12, 2012

Webcast and Meeting Slides and Event Pictures.



Thanks a lots to everyone who joined our "User Group Meeting" personally and on a Webcast.  Thanks to appreciates my efforts and thanks to make this user group meeting successful.

Their  was 6 new members who came in person to join the meeting and 6 users were attending the event online.


  • Doing event online and in-presence was a kind of experiment which went very well.
  • We also broadcast the webcast in "Hindi" the native language of India.

We discussed a lot of things in the user group meeting, we share thoughts, ideas related powershell with each other and we all enjoyed it.

Next Meeting:

Next meeting will be held in April, and please keep in touch / join us we will keep you updated about it.


Download the PPT Slide of the webcast from this link: http://dl.dropbox.com/u/17858935/PowerShell_Training_Presentation.pptx 

Event Pictures:

DSCN2981  DSCN2982  

DSCN2988  DSCN2989

DSCN2990  DSCN2993

DSCN2994  DSCN2996


Thanks a lot to everyone to make this event successful.


Aman Dhally

Friday, March 9, 2012

PowerShell Webcast.


PowerShell Webcast
Join us for a Webinar on March 10
Space is limited.

Reserve your Webinar seat now at:

The first web cast on Powershell. This is going to be the basic introduction of Powershell.

visit the below link for more info:


Aman Dhally
Title: PowerShell Webcast
Date: Saturday, March 10, 2012
Time: 11:00 AM - 1:00 PM IST
After registering you will receive a confirmation email containing information about joining the Webinar.
System Requirements
PC-based attendees
Required: Windows® 7, Vista, XP or 2003 Server
Macintosh®-based attendees
Required: Mac OS® X 10.5 or newer

Tuesday, March 6, 2012

Create a hardware Inventory using PowerShell.


The basic idea of this script to find the Parts Number and Serial Number of installed hardware. For example serial Number of Hard disk, Memory , Cd drives etc.

In my environment i want that this script should reside on Users Laptop/desktop. and create a batch file to call this powershell script.

The output of this script is in HTML and if you provides the details of your Exchange Server it can also send you the generated html files to the specified email id with attachment.

You can download the script from here: http://gallery.technet.microsoft.com/scriptcenter/Hardware-Inventory-Using-fe6611e0



Aman Dhally

Monday, March 5, 2012

New Delhi PowerShell User Group Meeting.


Finally we are doing our first PowerShell User Group Meeting. Please Check below for Details.

I am also planning to do the Live Meeting also. and will share the Links on your email with timing

Date: 10th March 2012 {Saturday}
Timing: Meeting will precisely starts at 11:00AM

  • Introduction to PowerShell : Aman Dhally
  • Why to use PowerShell. : Aman Dhally
  • Getting Started with PowerShell. : Aman Dhally
    • Tea/SNACKS ??
  • How to use PowerShell in day to day IT life ;-) : Aman Dhally
  • Case study on one PowerShell Script. : All Users Members
  • Discussions.?
  • Networking :-)
  • Mr. Kunal Bajaj, Partner, Director of Analysys Mason Limited.
Where to register:
Make sure you have printout of the ticket to enter in to the meeting.
Analysys Mason Limited.
BD-4th Floor,
Big Jo's Tower,
Netaji Subash Place ,
New Delhi 110034

       Behind "Max Hospital"
Google Map:
How to reach:
By Metro: The Nearest Metro Station is "Netaji Subash Place, Pitampura" ,the office is appox 500 Mtr. away.
By Bus: The nearest bus depot is"Wazirpur Bus Depot"
Reach me ?
Please feel free to contact me at: amandhally@gmail.com or on my mobile number +91 99-10-123-883

Come on!!! its free mate :)..

Aman Dhally

Friday, March 2, 2012

Remove Computer Account from All Domain controllers using PowerShell


If you are using Active Directory environment in you infrastructure then you does the one thing for sure , remove / add computers to the domain.

Some times when you format user computer and add it again to the Domain it gives an error that "Computer Already exists in the domain". Or you can say that you have multiple remote offices and syncing / replication between those  all DC's are slow  and you need to delete that computer from All DC including the local and remote domain Controllers.

I wrote this small script which delete the provided "computer" in to all DC which is on you replicated Server List. Before running this script make sure you have "Active Directory" module installed.

This script works for me and hope this works for you too.

You can Download the script from here : http://gallery.technet.microsoft.com/scriptcenter/Remove-Computer-Account-326f1e22

## make sure you have Active Directory Moudle Installed ##
# Import Module
Import-Module ActiveDirectory
# Variables
       $computer = $env:Computername     # Computername which you want to use
       $localdc = "Dc-XXXX"               # Chnage with ur local DC
       $credentials = Get-Credential   # This should be Admin Credentials
# AD  
       $ADResult = (Get-ADComputer -Filter {cn -like $computer}  -Server "$localdc" -Credential $credentials  ).name -eq $computer
       $dclist = (Get-ADDomain -Server "$localdc" -Credential $credentials).ReplicaDirectoryServers   
       $arrDc = @()
       foreach ($obj in $dclist) {
       $nlist = $obj.Replace("`.XYZ.com","")  # Replace XYZ.com with your Domain Name
       $arrDc += $nlist
# If you want to remove it from AD remove -wahtif and un-commnted -confirm:$false
       if ($ADResult -eq $true) {      
       Write-Host -ForegroundColor  Red "$computer exists in AD, I am going to remove it"
       foreach ( $dc in $arrdc) {
              Remove-ADComputer -Identity "$computer"  -Server $dc  -Credential $credentials  -whatif  #-confirm:$false
              write-host $([char]7)
              write-Host "$computer is deleted on $dc " -ForegroundColor Green
## ENd of Script##### a m a n   d h a l l y ________                
02-03-2012 15-35-04

You can Download the script from here : http://gallery.technet.microsoft.com/scriptcenter/Remove-Computer-Account-326f1e22

Thanks for Reading.
New Delhi PowerShell User Group
Aman Dhally

Thursday, March 1, 2012

New Delhi PowerShell User Group Users


Cool User Group Isn't ....


New Delhi PowerShell User Group




Clean Disk Space using PowerShell.


I wrote a simple PowerShell script which helps us to clean some of the disk space for us. This script wrote primarily for LENOVO laptops but can tweak it as per your requirements.

This Script does the following tasks:

  • ·         Clean users TEMP folder
  • ·         Empty Recycle Bin
  • ·         Empty SWTOOL Folder {mainly in Lenovo laptops}
  • ·         Empty Windows TEMP Folder
  • ·         Run Windows  Disk Cleanup Tool.

I hope that you like this tiny script J

Aman Dhally