
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2009 02:24 AM
Here is a script for viewing the Asset Tag and Serial Number for a remote computer.
It works as a custom action and also as standalone.
Attached is the vbs script, just change the txt extension to vbs.
Custom action command:
"\\server\folder\AssetTag.vbs" {computer}
AssetTag.vbs code:
On Error Resume Next
strPC = WScript.Arguments(0)
If strPC = "" Then
strPC = InputBox("Remote Computer:", "Remote PC Asset Tag")
End if
strComputer = strPC
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_SystemEnclosure",,48)
For Each objItem in colItems
strTag = "Asset Tag: " & objItem.SMBIOSAssetTag
Next
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
For Each objItem in colItems
strSerial = "Serial Number: " & objItem.SerialNumber
Next
WScript.Echo "Computer Name: " & strComputer & vbCrLf & strSerial & vbCrLf & strTag
It works as a custom action and also as standalone.
Attached is the vbs script, just change the txt extension to vbs.
Custom action command:
"\\server\folder\AssetTag.vbs" {computer}
AssetTag.vbs code:
On Error Resume Next
strPC = WScript.Arguments(0)
If strPC = "" Then
strPC = InputBox("Remote Computer:", "Remote PC Asset Tag")
End if
strComputer = strPC
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_SystemEnclosure",,48)
For Each objItem in colItems
strTag = "Asset Tag: " & objItem.SMBIOSAssetTag
Next
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
For Each objItem in colItems
strSerial = "Serial Number: " & objItem.SerialNumber
Next
WScript.Echo "Computer Name: " & strComputer & vbCrLf & strSerial & vbCrLf & strTag
Labels:
- Labels:
-
Custom Actions
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2023 12:58 PM
Hello everyone,
Due to the age of this post, it has been archived. Please feel free to start a new post if you wish to continue to discuss this topic.
Thank you for understanding.
