We help IT Professionals succeed at work.

Server Information

303 Views
Last Modified: 2013-11-05
I want a script to find every thing as shown below
name of the server    WMI1.5 installed(yes or no)    wmi service running?          DCOM Enabled      RPC service running?  Remote registry service running?  file & printer sharing installed  file & printer sharing enabled

The servers are a mix of windows 2003 and NT4.0.
I don't know if its possible to find all this info. Any help would be much appreciated.
Comment
Watch Question

Commented:
You can do this easily in Powershell... I have the shell of the script alreay.. still missing some components, but I will look into it tomorrow... 12:15am Here

# List of Servers
$list = "Text file list of servers"

# An Array to store Custom Objects
$myobjcollection = @()

#Loop through Servers
foreach($server in (get-content $list))
{
    # Create Custom Object
    $myobj ="" | select Name,WMI,WMIRunning,DCOM,RPCService,RemoteRegistry,FilePrintInstalled,FilePrintEnable
   
    # Add info to Object    $myobj.Name = $server
    $myobj.WMI = (get-WmiObject Win32_WMISetting -computername $server).BuildVersion
    $myobj.WMIRunning = # need to look into this
    $myobj.DCOM = # need to look into this
    $myobj.RPCService = ((Get-WmiObject Win32_Service -computername $server) | ?{$_.Name -match "RPCSs"}).State
    $myobj.RemoteRegistry = ((Get-WmiObject Win32_Service -ComputerName $server) | ?{$_.Name -match "RemoteRegistry"}).State
    $myobj.FilePrintInstalled = # need to look into this
    $myobj.FilePrintEnable = # need to look into this    
    # add object to array
    $myobjcollection += $myobj
}

#export $array to csv
$myobjcollection | export-Csv c:\temp\file.csv
CERTIFIED EXPERT

Author

Commented:
Thanks BsonPosh
I don't have a list of servers in a text file. I need to find them also.

Commented:
That is simple as well... I just assumed.

Tomorrow I will check back.. if you havent found a solution you like better I will try to add the missing pieces.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
BSonPosh......how can you check WMI remotely if WMI is not running?  All of the processes of determining remote PC info is done either via Remote Registry or WMI.....so I guess if your calls to those fail, then they're not running, and you'll have to visit the server physically......

Or perhaps PSExec could start those services......but it's going to be tricky to remotely identify the health of such things, as far as I know.

Regards,

Rob.

Commented:
To be honest... I wrote that in just a couple of minutes off my head and tested and it worked... I can easily change the WMI service queries to .NET queries... I actually just got some time to try this.

Commented:
Here is V2, I havent found a way to Check DCOM... its just there... I suppose I could check a specific component as for the file and print... I am at a lost... if you got me vbscript/C#code or batch that got it... I could easily add it.

# List of Servers
$list = "Text file list of servers"

# An Array to store Custom Objects
$myobjcollection = @()

#Loop through Servers
foreach($server in (get-content $list))
{
    # Create Custom Object
    $myobj ="" | select Name,WMI,WMIRunning,DCOM,RPCService,RemoteRegistry,FilePrintInstalled,FilePrintEnable
   
    # Add info to Object    $myobj.Name = $server
    $myobj.WMIRunning = (new-Object System.ServiceProcess.ServiceController("winmgmt","$server")).Status
    if($myobj.WMIRunning -match "Running")
    {$myobj.WMI = (get-WmiObject Win32_WMISetting -computername $server).BuildVersion}
    else{$myobj.WMI = 0}
    $myobj.DCOM = # need to look into this
    $myobj.RPCService = (new-Object System.ServiceProcess.ServiceController("RPCSs","$server")).Status
    $myobj.RemoteRegistry = (new-Object System.ServiceProcess.ServiceController("RemoteRegistry","$server")).Status
    $myobj.FilePrintInstalled = # need to look into this
    $myobj.FilePrintEnable = # need to look into this    
    # add object to array
    $myobjcollection += $myobj
}

#export $array to csv
$myobjcollection | export-Csv c:\temp\file.csv

Commented:
I should also note... if you like powershell

You could replace
$myobjcollection | export-Csv c:\temp\file.csv
with
$myobjcollection

Then you can do stuff like
#This will give you a list of Machines that dont have WMI running
$myobjCollection | Where{$_.WMIRunning -ne "Running"} | %{$_.Name}

#This will give you a list of Machines that dont have RPC Service running
$myobjCollection | Where{$_.RPCService -ne "Running"} | %{$_.Name}

All this interactive.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
BSonPosh, I really like PowerShell, but it's a bit complex for me at the moment, I'm not used to it!
As far as checking DCOM, I usually use Remote Registry to check
HKEY_LOCAL_MACHINE\Software\Microsoft\OLE\
There should be a String value (REG_SZ) called EnableDCOM. If not, create it. Set it's value to Y

Regards,

Rob.

Commented:
It looks complicated, but really is not at all. Its simple a paradigm shift from GUI to Console. To be completely honest... if you can use the cmd prompt you can use powershell.

but here is the regkey check
$key = "Software\Microsoft\OLE"
$Reg = [microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',$server)
$regValue= ($reg.OpnSubKey($key)).GetValue("EnableDCOM")
$myobj.DCOM = $regValue
CERTIFIED EXPERT

Author

Commented:
How can you run this script.
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Commented:
anything else needed here?
CERTIFIED EXPERT

Author

Commented:
thanks  BsonPosh

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.