added samples
[windows-sources.git] / sdk / samples / WCFSamples / TechnologySamples / Extensibility / Security / X509CertificateValidator / CS / GetComputerName.vbs
blob9bdad3eaf6dee0a06fc2af8eea484ecad12087d2
2 ' This script uses WMI to get the name of the machine be used as the CN ' for the certificates for WCF security samples.
4 set wmi = Getobject("winmgmts:")
5 wql = "select * from win32_computersystem"
6 set results = wmi.execquery(wql)
7 for each compsys in results
8 'check if the machine is in the workgroup or domain
9 if compsys.PartOfDomain = 0 or compsys.Domain = compsys.Workgroup then
10 ' only get the name of the machine
11 WScript.echo compsys.name
12 else
13 ' get the fully qualified name of the machine
14 n = compsys.name & "." & compsys.domain
15 WScript.echo n
16 end if
17 next