Function DetectOS(MachineName)
  Set WMI = GetObject(«winmgmts://» & MachineName)
  Set WMIQuery = WMI.ExecQuery(«Select Name « & _
    «from Win32_OperatingSystem»,,48)
  For Each os in WMIQuery
    osName = os.Name
  Next
  sOsName = Split(osName,»|»)
  DetectOs = osName(0)
  Set WMIQuery = nothing
  Set WMI = nothing
End Function