VB Script to collect Windows server hardware details on multiple machines.

VB Script to collect Windows server hardware details. Script will Collect Serial Number, Make, Model, OS, CPU, RAM, Drive details on multiple servers remotely.

Copy below contents and save as filename.vbs and create a machines.txt will all server names one per line.



Option Explicit

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

Const PATH_TO_INPUT = “Machines.txt”
Const PATH_TO_OUTPUT = “MachineInventory.csv”

Dim fso
Set fso = WScript.CreateObject(“Scripting.FileSystemObject”)

Dim shl
Set shl = WScript.CreateObject(“WScript.Shell”)

Dim input
Set input = fso.OpenTextFile(PATH_TO_INPUT)

Dim output
Set output = fso.CreateTextFile(PATH_TO_OUTPUT, True)

output.WriteLine “Hostname,Serial Number,Make,Model,BIOS Version,Operating System,CPU,Memory (MB),Disk Drives”

Dim wmiService
Dim wmiResults

Dim hostname
Dim make
Dim model
Dim biosversion
Dim operatingSystem
Dim serialNumber
Dim cpu
Dim memory
Dim drives

Dim line
Dim exec
Dim pingResults
While Not input.AtEndOfStream
line = input.ReadLine
hostname = “”
make = “”
model = “”
biosversion = “”
operatingSystem = “”
serialNumber = “”
cpu = “”
memory = “”
drives = “”

Set exec = shl.Exec(“ping -n 2 -w 1000 ” & line)
pingResults = LCase(exec.StdOut.ReadAll)

If InStr(pingResults, “reply from”) Then
WScript.Echo “Reply From: ” & line
On Error Resume Next

Set wmiService = GetObject(“winmgmts:\\” & line & “\root\CIMV2”)

If Not Err.Number = 0 Then
output.WriteLine line & “,Error: ” & Err.Description
WScript.Echo line & “,Error: ” & Err.Description
On Error GoTo 0
On Error GoTo 0
hostname = line

Set wmiResults = wmiService.ExecQuery(“SELECT * FROM Win32_BIOS”, “WQL”, wbemFlagReturnImmediately + wbemFlagForwardOnly)

Dim item
For Each item In wmiResults
serialNumber = Trim(item.SerialNumber)
biosversion = Trim(item.SMBIOSBIOSVersion)

Set wmiResults = wmiService.ExecQuery(“SELECT * FROM Win32_ComputerSystem”, “WQL”, wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each item In wmiResults
make = Trim(item.Manufacturer)
model = Trim(item.Model)

Set wmiResults = wmiService.ExecQuery(“SELECT * FROM Win32_OperatingSystem”, “WQL”, wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each item In wmiResults
operatingSystem = Trim(item.Name)
operatingSystem = Split(operatingSystem, “|”)(0)
memory = Round(Trim(item.TotalVisibleMemorySize) / 1024, 2)

Set wmiResults = wmiService.ExecQuery(“SELECT * FROM Win32_Processor”, “WQL”, wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each item In wmiResults
cpu = Trim(item.Name)

Set wmiResults = wmiService.ExecQuery(“SELECT * FROM Win32_LogicalDisk WHERE DriveType=3”, “WQL”, wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each item In wmiResults
drives = drives & Trim(item.DeviceID) & ” ” & Round(Trim(item.Size) / (1024^2), 2) & “;”

output.WriteLine hostname & “,” & serialNumber & “,” & make & “,” & model & “,” & biosversion & “,” & operatingSystem & “,” & cpu & “,” & memory & “,” & drives
WScript.Echo hostname & “,” & serialNumber & “,” & make & “,” & model & “,” & biosversion & “,” & operatingSystem & “,” & cpu & “,” & memory & “,” & drives
End If
output.WriteLine line & “,No Response”
WScript.Echo line & “,No Response”
End If


Set wmiService = Nothing
Set wmiresults = Nothing






Windows Server 2008 keeps rebooting to repair mode.

Today, one of the Windows 2008 server was rebooted and the server was not back online after the expected time. When checked the console, server was on to Windows repair mode. On multiple reset and reboot the scenario was same. Server was keep on login to repair mode. Laer, I was success in fixing the issue following the steps listed below:

Booted the server using the DVD or any bootup media.

Run sfc /scannow /offbootdir=f:\ /offwindir=f:\windows

If this does not fix the problem, continue with below steps:

Loaded hive into the registry:

1. Open Registry Editor.
2. Click either the HKEY_USERS key or HKEY_LOCAL_MACHINE key.
3. On the File menu, click Load Hive….
4. Select System file from “c:\windows\system32\config”.
4. Find the hive you want to load and click it.
5. Click Open.
6. Key name as TEST

Checked with the currentcontrolset001

Unloaded the hives

Rebooted the server normally and the issue is fixed.


Enable disk cleanup in Windows 2008 without reboot.

Sometime recovering free disk space on Windows 2008 is hard and we find dependency over the diskcleanup utility. Disk cleanup utility will help us in deleting unwanted temporary files, downloaded files, service pack files, etc.

By default, disk cleanup is not available in Windows 2008 and to enable it requires a reboot. While you enable it, there are other utilities which also gets installed while enabling disk cleanup.

Therefore, you can skip and get this done by coping 2 files to specific system folders and you can immediately use the tool:

Copy Cleanmgr.exe to %systemroot%\System32.
Copy Cleanmgr.exe.mui to %systemroot%\System32\en-US.
The 2 files are located in
– C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe
– C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui

You can then start the tool by executing Cleanmgr.exe.

Updated 9/21/2015:
Execute Below Command to Execute.

copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe %systemroot%\System32
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui %systemroot%\System32\en-US



Forcibly remove failover cluster feature.

Forcibly remove failover cluster feature.

I was asked to take a clone of Windows 2008 server and release it to appliation team as a replacement server for another standalone Windows 2008 server. Clone was successfully completed and found that the source of the clone is a cluster node. Hence, I had to remove the filover cluster. As this was a virtual server I had the liability of disconnecting it from network and conencted using local admin account. Unfortunately, it was not allowing to uninstall cluster, it required AD authentication. Taking the server back to network and trying to remove the cluster was challenging as this had the possibilities of impacting the existing cluster setup. Sever Manager will not allow you to remove the cluster feature as its still a part of a cluster. Hence, I was then able to find a work around using the registry.

1. Take the complete backup of the registry.
2. Locate HKLM\CurrentControlSet\Services\
3. Delete the keys “ClusDisk” & “ClusSvc”
4. Now try uninstalling the Failover CLustering.
5. You will be prompted with “Have you removed this server from the cluster?”. Yes, I’ve removed this server from the cluster or No. I still need to remove this server from the server.”
6. Click on “Yes, I’ve removed this server from the cluster.”
7. Reboot the server.

You now has the liability of adding the same feature back and setup a new cluster.


VMware Error 0x0000005D

When you try to install Windows Operating System, you would come across an error code 0x0000005D. This is purely an issue related to the virtual machine profile. Please validate if you have selected a correct profile. if not please choose the correct profile and restart the installation process.

In my case, was trying to deploy Windows 2003 std edition for a legacy application using SCCM 2012. Had no clue with the error code 0x0000005D, though I have set Windows 2003 Std 32 Bit in profile. Later realized that the SCCM is using the latest version and then selected the corresponding 64bit profle like Windows Server 2003 Enterprise x64 Edition – from the drop-down list. Voila it fixed my issue.

VM profile is available at below path.

VM->Edit Settings->Options->General Options->Version


VMware P2V or V2V gives error Unable to contact the specified host.

When you do a P2V or V2V of Windows 2008 server using VMware Converter you might get the below error:

Unable to contact the specified host. The host is not available, there is a network configuration problem, or the management services on the host are not responding.

In order to execute the conversion process, it is necessary to open the required ports on the source. This error would be displayed when the required TCP and UDP ports are not open.

Hence, the best solution is to disable the firewall to fix the issue.

In my case the issue was fixed using the below command.

NetSh Advfirewall set allprofiles state off


Upgrading Windows 2008 R2 editions from the command line without media.

Tested something new with Windows 2008 today. Windows 2008 has an inbuilt utility called the Deployment Image Servicing and Management (DISM) tool which does not require any media to upgrade the edition and just needs a reboot.

this is not possible on a domain controllers and only do upgrades, not downgrades.
Supported Windows 2008 R2 upgrade paths are:

Windows Server 2008 R2 STD -> Windows Server 2008 R2 ENT -> Windows Server 2008 R2 DC
Windows Server 2008 R2 STD Core -> Windows Server 2008 R2 ENT Core -> Windows Server 2008 R2 DC Core
Windows Server 2008 R2 Foundation -> Windows Server 2008 R2 STD

To upgrade, you need to provide a valid 25-character product key for the edition to which you’re upgrading.

To determine the installed edition, run:

DISM /online /Get-CurrentEdition

To check the possible target editions, run:

DISM /online /Get-TargetEditions

Finally, to initiate an upgrade, run:

DISM /online /Set-Edition: /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

So, for example, to upgrade to Windows Server 2008 R2 Datacenter from a downlevel edition, you would run:

DISM /online /Set-Edition:ServerDatacenter /productkey:ABCDE-ABCDE-ABCDE-ABCDE-ABCDE

After running the /Set-Edition command, DISM will prepare the operating system for the edition servicing operation, then reboot twice while it applies the changes to the operating system. After the final reboot, you’ll be running the new edition!


Outbound Emails blocked on Windows Server.

Recently, came across an issue where the outbound SMTP mail where getting blocked. When checked the server and firewall settings everything looked very normal. Finally, the issue was with McAfee. McAfee access protection has a feature to block the out going e-mails. Hence, below listed steps where performed to fix the issue.

1. Click Start, Programs, McAfee, VirusScan Console.
2. Right-click Access Protection and select Properties.
3. Click the Access Protection tab.
4. Under Categories on the left, select Anti-virus Standard Protection.
5. In the right pane, select Prevent mass mailing worms from sending mail.
6. Click on , block tab relevant to “Prevent mass mailing worms from sending mail to remove tick mark.
6. In the Processes to exclude section, type the process name, then click OK to close the Rule details window.
7. Click Apply then close the Access Protection Properties window.


VM Tools Update Failure [solved]

During VM Tools update, if you find any issues like unable to remove older version of VMware Tools or error 1714, you can remove old version manually from the registry to resolve the issue:

1. Open the Windows Registry using regedit.
2. Browse to HKLM\Software\Microsoft\Windows\CurrentVersion\uninstall.
Search for the branch with a key named DisplayName and has a value of VMware Tools.
Delete the branch associated with that entry. Do not delete the entire uninstall branch.
3. Browse to HKLM\Software\Classes\Installer\Products.
Search for the branch with the key named ProductName and has a value of VMware Tools.
Delete the branch associated with that entry.
4. Browse to HKEY_CLASSES_ROOT\Installer\Products.
Search for the branch with the key named ProductName and has a value of VMware Tools.
Delete the branch associated with that entry.
5. Browse to HKLM\Software\VMware.
Delete the branch called VMware Tools.
6. Ensure the folder located in %ProgramFiles%VMwareVMware Tools is deleted.
7. Install the new version of VMware Tools.

NOTE: Take the backup of the registry before performing the above steps.