Hi,
Im trying to write a script where i put in a hostname and then he should return me the serial number of the pc
strComputer = inputbox("machine name to query")
strNamespace = "root\cimv2"
strUser = "Admin"
strPassword = "password"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colBIOS = objWMIService.ExecQuery _
("Select * from Win32_BIOS")
For each objBIOS in colBIOS
Wscript.Echo "Serial Number: " & objBIOS.SerialNumber
Next
but everytime i get an acces denief (users are not admin on there profile) thats why i included the credentials.
whats wrong ??
thx,
Im trying to write a script where i put in a hostname and then he should return me the serial number of the pc
strComputer = inputbox("machine name to query")
strNamespace = "root\cimv2"
strUser = "Admin"
strPassword = "password"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colBIOS = objWMIService.ExecQuery _
("Select * from Win32_BIOS")
For each objBIOS in colBIOS
Wscript.Echo "Serial Number: " & objBIOS.SerialNumber
Next
but everytime i get an acces denief (users are not admin on there profile) thats why i included the credentials.
whats wrong ??
thx,