richardrekos
MIS
Well, thaks to helpful direction, I am just about there. Any ideas on how to start this script from the begining after the user clicks OK on the popup box for Sub rich()?
strComputer = InputBox("Enter computer name and click ok. If you don't know the name of your computer, click cancel")
If strComputer = "" Then
call rich()
Else
call rich2()
End IF
Sub rich()
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" _
& strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery( _
"Select * from Win32_ComputerSystem",,48)
For Each objItem in colItems
Wscript.Echo "Name: " & objItem.Name
Next
End Sub
Sub rich2()
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "c:\Assettracker\clientcon.exe"
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "richard.rekos@questionmark.com"
objEmail.To = "richard.rekos@questionmark.com"
objEmail.Subject = "AT Output"
objEmail.Textbody = "AT Output"
objEmail.AddAttachment "C:\assettracker\data\" _
& strComputer & ".xml"
objEmail.Send
End Sub
strComputer = InputBox("Enter computer name and click ok. If you don't know the name of your computer, click cancel")
If strComputer = "" Then
call rich()
Else
call rich2()
End IF
Sub rich()
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" _
& strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery( _
"Select * from Win32_ComputerSystem",,48)
For Each objItem in colItems
Wscript.Echo "Name: " & objItem.Name
Next
End Sub
Sub rich2()
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "c:\Assettracker\clientcon.exe"
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "richard.rekos@questionmark.com"
objEmail.To = "richard.rekos@questionmark.com"
objEmail.Subject = "AT Output"
objEmail.Textbody = "AT Output"
objEmail.AddAttachment "C:\assettracker\data\" _
& strComputer & ".xml"
objEmail.Send
End Sub