Ever wanted to have a VBScript command line shell? Nothing as fancy as a full windows shell. Just something you could execute from a third party scripting language that can read and write from the standard IO?
If so, give this a gander ^_^
VBSShell.CMD
VBSShell.VBS
Tuesday, May 17, 2011
Tuesday, February 22, 2011
Whats that HASH?
Want to update a MsiFileHash value? Use this simple VBScript to get the hash values for a file then you can update the table using a transform.
Dim FilePath, oDlg
If WScript.Arguments.Count = 1 Then
FilePath = WScript.Arguments.Item(0)
Else
With CreateObject("UserAccounts.CommonDialog")
.Filter = "All Files|*.*"
If .ShowOpen = 0 Then
Wscript.Quit -1
Else
FilePath = .FileName
End If
End With
End If
With CreateObject("WindowsInstaller.Installer").FileHash(FilePath,0)
InputBox "File Hash for:" & vbCrLf & FilePath, "msiFileHash Value Generator", .StringData(1) & "," & .StringData(2) & "," & .StringData(3) & "," & .StringData(4)
End With
WScript.Quit 0
If WScript.Arguments.Count = 1 Then
FilePath = WScript.Arguments.Item(0)
Else
With CreateObject("UserAccounts.CommonDialog")
.Filter = "All Files|*.*"
If .ShowOpen = 0 Then
Wscript.Quit -1
Else
FilePath = .FileName
End If
End With
End If
With CreateObject("WindowsInstaller.Installer").FileHash(FilePath,0)
InputBox "File Hash for:" & vbCrLf & FilePath, "msiFileHash Value Generator", .StringData(1) & "," & .StringData(2) & "," & .StringData(3) & "," & .StringData(4)
End With
WScript.Quit 0
Thursday, February 3, 2011
IsAdmin?
'## Example
If IsAdmin() Then
MsgBox "User is in the local Administrators Group"
End If
If Not IsAdmin() Then
MsgBox "User is NOT in the local Administrators Group"
End If
'## Helper Functions
Function IsAdmin()' As Boolean
Dim oG,oU
ExecuteGlobal "If IsEmpty(bIsAdmin) Then Dim bIsAdmin"
If IsEmpty(bIsAdmin) Then
bIsAdmin = False
Set oG = GetObject("WinNT://./Administrators")
For Each oU in oG.Members
If oU.Name = WshNetwork.UserName Then
bIsAdmin = true
End If
Next
End If
IsAdmin = bIsAdmin
End Function
Function WshNetwork()' As Wscript.Network
ExecuteGlobal "If IsEmpty(oWshNetwork) Then Dim oWshNetwork"
If Not IsObject(oWshNetwork) Then
Set oWshNetwork = CreateObject("Wscript.Network")
End If
Set WshNetwork = oWshNetwork
End Function
If IsAdmin() Then
MsgBox "User is in the local Administrators Group"
End If
If Not IsAdmin() Then
MsgBox "User is NOT in the local Administrators Group"
End If
'## Helper Functions
Function IsAdmin()' As Boolean
Dim oG,oU
ExecuteGlobal "If IsEmpty(bIsAdmin) Then Dim bIsAdmin"
If IsEmpty(bIsAdmin) Then
bIsAdmin = False
Set oG = GetObject("WinNT://./Administrators")
For Each oU in oG.Members
If oU.Name = WshNetwork.UserName Then
bIsAdmin = true
End If
Next
End If
IsAdmin = bIsAdmin
End Function
Function WshNetwork()' As Wscript.Network
ExecuteGlobal "If IsEmpty(oWshNetwork) Then Dim oWshNetwork"
If Not IsObject(oWshNetwork) Then
Set oWshNetwork = CreateObject("Wscript.Network")
End If
Set WshNetwork = oWshNetwork
End Function
Subscribe to:
Posts (Atom)