I had free time this evening , and I thought of using this time for PowerShell Scripting . So I came up with an IDEA to build a Powershell script which will query the list of servers and get the status of services(windows server) whose StartMode is set as Automatic.

As All of us know (Windows Administrators) , If the startmode of a service is set to automatic , that service has to be in “RUNNING” State ( Even If it screw’s your System 🙂 )

Some times this will not be the case , On Most of the instances if the server is patched and rebooted , some of the Automatic Services will not start.

To determine the servers and list of services , One can use Below PowerShell Code

I work in a enviorment , where we patch our servers on Monthly basis . Post patching it is important for us to know about the server status , How many servers got patched , How many servers are still have the downloaded patches , How many serveers have failed to install the patches Etc.

I came up with an IDEA to write a PowerShell Script to get an overall Overview about this.

Below is the script which one can use to Accomplish the above task ,

Note – Before Running the script make sure you have created a C:\Names.txt file (List of servers goes here) against which you will query WSUS server to get the details.

You need to put WSUSServerName , If you are using SSL then Please put $TRUE , and If you are using any other port otherthan 80 , then put the appropriate port ,. If you are using Default port please let it blank

script will produce C:\PatchResult.csv which contains all the required information.

I was participating in Powershell TechNet forum and someone asked question about how to add the ‘A’ Records and ‘PTR’ Records in DNS server . I thought it will be a good excercise for me , ( As I still have sleepless night when I think of Powershell :))

After working for long hours , I have built below script.

Note- One should have C:\DNS.CSV with columns as Hostname and IP address which needs to assinged.

If you are a windows server administrator then , one or the other day you will be asked to get the UPTime report of list of windows servers (Most of the times your Boss will ask this :))

Below Script will help you to get the UPtime report of listed servers

Before you run the script ,

Create a text file servers.txt in C:\ Drive and list the servers against which you need to run this query (The Script will list out the UPtime report of listed server)

Description –

This script will make use of WMI Query (Class – win32_Operatingsystem) and get the lastboottime of listed server. Script will produce 2 TXT Files namely , UPtimeReport.txt and Offline.txt in your C:\ Drive

Note – If all the servers are online then offline.txt will not be created and Vice Versa . i.e if all the servers are offline then UPTimeReport.txt will not be created.

PowerShell Script

#Title – Script for querying windows server UPTime/Lastboot

#Description – This script queries windows servers listed in Servers.txt file (WMI Query) and get their last bootuptime