Webmaster Forum

Go Back   Webmaster Forum > Scripting/Programming & Debugging > ASP & VBScript Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

ASP & VBScript Forum Need help from a webmaster with ASP or VBScript, you may ask in this forum?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-14-2007, 08:39 PM
ajpow365 ajpow365 is offline
Junior Member
 
Join Date: Dec 2007
Posts: 2
ajpow365 is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default Handle Error by writing line and move on

I have a script that gather's some info on a remote pc. It reads from a text file and then writes to another file w/ the info. Some PC's are offline and instead of just "On Error Resume Next" I would like to send a message after it writes the strComputer name and say something like "Systen Now Offline".

Cannot seem to get it.

Here's the code.

Thanks!

On Error Resume Next

DIM fso, IPAKFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set IPAKFile = fso.CreateTextFile("IPAK_query.txt", True)

Const HKEY_LOCAL_MACHINE = &H80000002

Set InputFile = fso.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine

Set oReg=GetObject("winmgmts:{impersonationLevel=imper sonate}!\\" & _
strComputer & "\root\default:StdRegProv")

IPAKFile.WriteLine("Computer Name: ") &strComputer


If Err.Number <> 0 Then

IPAKFile.WriteLine("System is Offline")

End If
On Error GoTo 0


strKeyPath = "SOFTWARE\Company\Client Image"
strValueName = "CurrentVersion"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValu e
IPAKFile.WriteLine("Current TCO Image Version: ") & strValue

strValueName = "Edition"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValu e
IPAKFile.WriteLine("OS Edition: ") & strValue

strValueName = "InstallDate"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValu e
IPAKFile.WriteLine("Install Date: ") & strValue

strValueName = "InstallVersion"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValu e
IPAKFile.WriteLine("Current Install Version: ") & strValue

strValueName = "ServicePack"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValu e
IPAKFile.WriteLine("Current Service Pack: ") & strValue

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninsta ll\tcoo2kpatch"
strValueName = "DisplayName"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValu e
IPAKFile.WriteLine("Current TCO Office Updater Version: ") & strValue

IPAKFile.WriteLine(".............................. ...................")

Loop
Wscript.Echo "Done"
Reply With Quote

This ad is part of our Revenue Sharing program
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:49 AM.


Creative Commons License
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30