VBS Script to Verify If The Admin$ Share Exists On A List Of Machines

Before deploying SCCM Client to the client machine we need to confirm if Admin$ Share Exists. Instead of doing the same manually, we have created the script which you can use to test if the share exists on client machine or not. Hope it helps to automate your process!!!!

Create a text file created with the Computer Names.

Below is the script for checking AdminShare$ on client systems in the environment.

 Actual Script:-

Set objExcel = CreateObject(“Excel.Application”)
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = “Computer Name”
objExcel.Cells(1, 2).Value = “Admin Share Exists” 
Set Fso = CreateObject(“Scripting.FileSystemObject”)
Set InputFile = fso.OpenTextFile(“ComputerList.Txt”)
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine
On Error Resume Next
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
Set colShares = objWMIService.ExecQuery(“Select * from Win32_Share Where Name = ‘ADMIN”)
objExcel.Cells(intRow, 1).Value = UCase(strComputer)
If colShares.Count > 0 Then
objExcel.Cells(intRow, 2).Value = “Yes”
Else
objExcel.Cells(intRow, 2).Value = “No”
End If
If Err.Number 0 Then
objExcel.Cells(intRow, 2).Value = Err.Description
Err.Clear
End If
intRow = intRow + 1
objExcel.Range(“A1:B1”).Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
loop
Wscript.Echo “Done”
To Run the script:
               1. Open cmd as administrator
               2. Go to the vbs file location
               3. Run the script as below

 It will give the successful prompt “Done” as shown below.

 Below is the excel sheet with the result.

When you have the result then you can suitably go ahead with the SCCM Client deployment.

2 thoughts on “VBS Script to Verify If The Admin$ Share Exists On A List Of Machines

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s