Pages

Friday, 20 July 2012

Display Message with Timer - VBScript



Following Script displays a message for 60seconds OR until user clicks OK.

a = "WSS 4.1 is already installed, Exiting WSS 5.0 Installation"
Set sh = CreateObject("WScript.Shell")
sh.Popup a,60, ""


Wednesday, 18 July 2012

Check if Registry Exists - VBScript


Const HKEY_CURRENT_USER = &H80000002


strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")


strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{039694F1-2108-4B3E-8575-85C245210F94}"


strValueName = "DisplayName"
objRegistry.GetStringValue HKEY_CURRENT_USER,strKeyPath,strValueName,StrValue




If IsNull(StrValue) Then
    Wscript.Echo "The registry key does not exist."
Else
    Wscript.Echo "The registry key exists."
End If

Bring a Process to Front for User Focus - AutoIT Script


Compile the following script using AutoIT and pass the process to be brought to front as commandline


For Example: BringToFront.exe "Caculator"





 AutoIt Version: 3.3.0.0
 Author:         myName


 Script Function:
Bring Window to front.


#ce ----------------------------------------------------------------------------
AutoItSetOption("TrayIconHide", 1)


If $CmdLine[0] > 0 Then
$WinTitle = $CmdLIne[1]
Else
Exit 1
EndIf
If $CmdLine[0] > 1 Then
$WinText = $CmdLIne[2]
Else
$WinText = ""
EndIf


WinWait($WinTitle, $WinText, 60)
If WinExists($WinTitle, $WinText) Then
WinActivate($WinTitle, $WinText)
EndIf


Remove Trailing Backslash - VBScript




On Error Resume Next


Dim strNewValue, Path, slash


       Path = InputBox("Enter Folder Path", "Please Enter", "")


       slash = Len(DatabasePath1)-1


       strNewValue = mid(Path, 1, slash)


msgbox StrNewValue

Tuesday, 17 July 2012

Citrix License Administration Console

When you launch the shortcut "License Administration Console" you will receive following Error.




It looks like its a but, However, tTo access Citrix License Administration Console, type the following URL in your browser


http://localhost:8082

Monday, 16 July 2012

Get RAM Size - VBSCript

Following script displays the RAM present on a system



Option Explicit
Dim objWMIService, objComputer, colComputer 
Dim strLogonUser, strComputer 


strComputer = "."   
Set objWMIService = GetObject("winmgmts:"& "{impersonationLevel=impersonate}!\\"& strComputer & "\root\cimv2") 
Set colComputer = objWMIService.ExecQuery("Select * from Win32_ComputerSystem") 


For Each objComputer in colComputer 
Wscript.Echo "System Name: " & objComputer.Name & vbCr & "Total RAM " & objComputer.TotalPhysicalMemory/(1024*1024)
Next 


WScript.Quit