December, 2010

  • ConfigMgrDogs

    Find domain membership via WMI

    • 0 Comments

    Here’s a quick and dirty VBScript to find the domain of a certain computer. Great for things like SCCM OS Deployment.

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
    Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
    For Each objComputer in colSettings
    Wscript.Echo "Domain: " & objComputer.Domain
    Next

    Matt Shadbolt

Page 1 of 1 (1 items)