Pages

Monday, 29 August 2011

Logoff Windows using VBScript

Following VBScript can be used to Logoff machine. Test it and Enjoy
  
Set WshShell=WScript.CreateObject("WScript.Shell")  
  
 WshShell.run "shutdown.exe -L -F"  
 

Get ComputerName + VBScript

Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
MsgBox("ComputerName = " & sComputername)

Active Setup Registry Keys

Following Registries are to be included in package to load User settings(either registries/files) so that by the time User
logs in his current user settings will be available on the machine.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]]
"StubPath"="msiexec /fup {9A346205-EA92-4406-B1AB-50379DA3F057} /qn"
"Version"="1,0"

Set Working Directory to Shortcut Using VBScript

Set objShell = WScript.CreateObject("WScript.Shell")
Set objShtCut = objShell.Createshortcut("C:\Documents and Settings\All Users\Start Menu\Programs\ShortcutName.lnk")
objShtCut.WorkingDirectory = "C:\PROGRA~1\MKSTOO~1\Demonstrations\bin"
objShtCut.Save
'WScript.Echo objShtCut.WorkingDirectory

VBScript to Terminate Process

Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill 
strProcessKill = "'ProcessName.exe'" 
Set objWMIService = GetObject("winmgmts:root\cimv2") 
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next 
WScript.Quit

Ger CurrentDirectory using VBScript

on Error Resume Next

	Set objWshShell = CreateObject("WScript.Shell")
	Set objFileSystem = CreateObject("Scripting.FileSystemObject")

	sScriptDir=objFileSystem.GetParentFolderName(WScript.ScriptFullName)

msgbox sscriptdir

Installshield 2012 Released

Installshield 2012 is the latest version best installation development solution which can be downloaded from flexera Software website