I replaced the line as suggested and got the following error.
Line: 2
Char: 1
Error: The remote server machine does not exist or is unavailable" 'GetObject'
Code: 800A01CE
Source: Microsoft VBScript runtime error
Main Topics
Browse All TopicsI found a VB script that allows me to get the service tag off of remote computers. However it doesn't work on all hardware, but I found another script that does work on all hardware, but this script will not get the service tag remotely. How can I fix the remote script using code from the local script so that it will retrieve the service tag on all hardware? Thanks!!
-------- START remote get service tag --------
ComputerName = InputBox("Enter the name of the computer you wish to query")
winmgmt1 = "winmgmts:{impersonationLe
'WScript.Echo winmgmt1
Set SNSet = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")
for each SN in SNSet
MsgBox "The serial number for the specified computer is: " & SN.SerialNumber
Next
-------- END remote get service tag --------
-------- START local get service tag --------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Set colSMBIOS = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
Wscript.Echo "Serial Number: " & objSMBIOS.SerialNumber
Next
-------- END local get service tag --------
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
That just means that the remote PC wasn't available (or was being blocked by a firewall)
The default setting for the built-in firewall for XP Service Pack 2 and beyond excludes remote administration. Run the following on the remote PC to configure the firewall:
netsh firewall set service RemoteAdmin enable
For additional information see: http://msdn.microsoft.com/
No!! That error happens as soon as I run the script, I don't even get a prompt to enter the computer name. Here is the script modified as you suggested.
----- Start Code -----
strComputer = "RemoteComputerName"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Set colSMBIOS = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
Wscript.Echo "Serial Number: " & objSMBIOS.SerialNumber
Next
----- End Code -----
The script works just fine for me. I can see tag of my own machine with strComputer ="." or strComputer="MyMachineName
Also the script is not supposed to prompt anything. The RemoteMachineName must be replaced with the machine name that you are trying to access.
amit_g,
Take a look at my first post, try and use the script I called "remote get service tag". This script will prompt me for a computer to query. This is exactly how the script should function, however upon returning the value of the serial number (service tag) it doesn't always work on older hardware. Now take a look at the second script I posted called "local get service tag" and run this script. This particular script will not ask for a remote machine to query, it will only run on the machine it is executed on. The part about this second script I would like to integrate into the first script is that it will work on older hardware and return a value for the Serial number (service tag).
Thanks,
DMS
That is exactly I have been saying so far. The second script would get the remote computer's tag if you change
strComputer = "."
to
strComputer = "WriteYourRemoteComputerNa
You should have first tested this way to make sure that it works for you too. Once tested you can simply modify the script to the following to do it dynamically.
ComputerName = InputBox("Enter the name of the computer you wish to query")
strComputer = ComputerName
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Set colSMBIOS = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
Wscript.Echo "Serial Number: " & objSMBIOS.SerialNumber
Next
Business Accounts
Answer for Membership
by: amit_gPosted on 2007-02-13 at 13:17:44ID: 18526268
Just change
strComputer = "."
to
strComputer = "RemoteComputerName"
and make sure to run as domain administrator.