Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send results of script to clipboard

Status
Not open for further replies.

ITFrank

IS-IT--Management
Apr 20, 2011
1
US
Hello,

I have the following script:

ComputerName = InputBox("Enter the name of the computer you wish to query")

winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& ComputerName &""

'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

I would like to had the results, the serial number found, to my clipboard. How can I achieve this?
 
Use IE.

Code:
ComputerName = InputBox("Enter the name of the computer you wish to query")

winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& ComputerName &""

'WScript.Echo winmgmt1

Set SNSet = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")

for each SN in SNSet
[green]
    dim objIE
    set objIE = CreateObject("InternetExplorer.Application")
    objIE.Navigate("about:blank")

    do until objIE.ReadyState=4: wscript.sleep 1: loop  

    objIE.Document.ParentWindow.ClipboardData.SetData "Text", SN.SerialNumber
    objIE.Quit
[/green]
Next

-Geates



"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top