Computer Domain WMI





2
Date Submitted Thu. Mar. 2nd, 2006 10:39 AM
Revision 1 of 1
Syntax Master dannyboy
Tags DOMAIN | VBSCRIPT | WMI
Comments 0 comments
Get the computer domain with wmi

Function GetComputerDomain()
        On Error Resume Next
        Set OpSysSet = GetObject("winmgmts:\root\cimv2").ExecQuery("select * from Win32_ComputerSystem")
        for each i in OpSysSet
        ' There should only be one anyway, but we'll do this to be sure to be sure.
                GetComputerDomain = i.Domain
        next
End Function
 

Comments

There are currently no comments for this snippet.

Voting