VB script to modify shortcut properties

As part of application repackaging, you need to update some of the properties of an application shortcut as post install action of an installer. Below is the code that can be used to auto update the shortcut properties as needed. [code language=”vb”] Set sh = CreateObject("WScript.Shell") Set FSO = CreateObject("Scripting.FileSystemObject") FSO.DeleteFile("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\PowerGUI\PowerGUI.lnk") Set shortcut = sh.CreateShortcut("C:\ProgramData\Microsoft \Windows\Start Menu\Programs\PowerGUI\PowerGUI.lnk") shortcut.TargetPath = "C:\Program Files\PowerGUI\AdminConsole.exe" shortcut.Arguments = "-auto none" shortcut.WindowStyle = 7 shortcut.Save [/code]

Read more

VBScript to Disable/Hide Task Bar in Windows XP

VBScript to Disable/Hide Task Bar in Windows XP [code language=”vb”] ‘xp_taskbar_desktop_fixall.vbs – Repairs the Taskbar when minimized programs don’t show. Set WSHShell = WScript.CreateObject("WScript.Shell") Message = "To work correctly, the script will close" & vbCR Message = Message & "and restart the Windows Explorer shell." & vbCR Message = Message & "This will not harm your system." & vbCR & vbCR Message = Message & "Continue?" X = MsgBox(Message, vbYesNo, "Notice") If X = 6 Then On Error Resume Next WshShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2\" WshShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StreamMRU\" WshShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop\" WshShell.RegDelete "HKCU\Software\Microsoft\Internet Explorer\Explorer Bars\{32683183-48a0-441b-a342-7c2a440a9478}\BarSize" P1 = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\" WshShell.RegWrite p1 & "NoBandCustomize", 0, "REG_DWORD" WshShell.RegWrite […]

Read more

Visual Basic Script to Query .MDB Database via “MS Access Database” User DSN

Visual Basic Script to Query .MDB Database via “MS Access Database” User DSN [code language=”vb”] Const adOpenStatic = 3 Const adLockOptimistic = 3 Const adUseClient = 3 Set objConnection = CreateObject("ADODB.Connection") Set objRecordset = CreateObject("ADODB.Recordset") objConnection.Open "DSN=MS Access Database;" objRecordset.CursorLocation = adUseClient objRecordset.Open "SELECT * FROM Connection" , objConnection, _ adOpenStatic, adLockOptimistic objRecordset.MoveFirst() Do Until objRecordSet.EOF Wscript.Echo "Connection Name: " & objRecordSet.Fields("ConnectName").Value objRecordSet.MoveNext Loop objRecordset.Close objConnection.Close [/code] .

Read more