1.

Solve : Easiest VBSCRIPT question of the day?

Answer»

I have the FOLLOWING vbscript

Code: [Select]' VBScript to Display ComputerName

Set WshNetwork = WScript.CreateObject("WScript.Network")
'
WScript.Echo ("This computer is... "& WshNetwork.ComputerName & vbCrLf & vbCrLf & _
"Active user is... " & WshNetwork.username)

I want to ADD OS name to my script. I have found these two "ways":
wmic os get caption
(gwmi win32_operatingsystem).caption
but I don't know "OO" or VBS scripting so I don't know what to do.

TIAI was ABLE to get a WORKING answer from the link PROVIDED (above). I had done many searches, but I didn't know what to search for.

Problem SOLVED

THANK YOUThis is the bare minimum you need
Code: [Select]Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
Set oss = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each os in oss
Wscript.Echo "Caption: " & os.Caption
Next



Discussion

No Comment Found