Showing posts with label VBS. Show all posts
Showing posts with label VBS. Show all posts

Sunday, June 23, 2013

Thursday, April 25, 2013

Read Registry from Local or remote Machine

'to read HKEY Local Machine registry

const HKEY_LOCAL_MACHINE = &H80000002

'prompt for the machine name to input for scanning, the in front part is the prompt and behind one is for Title

strComputer = ""

Set oReg=GetObject( _

   "winmgmts:{impersonationLevel=impersonate}!\\" &_

    strComputer & "\root\default:StdRegProv")

'registry path

strKeyPath = "software\citi\agent"

'registry Value Name

strValueName = "redirect"

'value that it is going to read

oReg.getstringvalue _

   HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

'show with msgbox for the result

MsgBox (strComputer &" CITI agent Status is " & strValue)

Monday, May 21, 2012

Check file exist

Here is how to check for file exist while we copy to or from machine’s data
Example below show the checking of CMD.exe in Windows\system32 folder

'Set Object
Set fso = CreateObject("Scripting.FileSystemObject")

'Create Condition
If (fso.FileExists("C:\windows\system32\cmd.exe")) Then
'Alert User
WScript.Echo("File exists!")
WScript.Quit()
Else
'Alert User
WScript.Echo("File does not exist!")
End If

'Exit Script
WScript.Quit()

Wednesday, March 14, 2012

Wednesday, February 29, 2012