Removed hostname checking and fixed crash if connect to image share fails.
This commit is contained in:
parent
fc2dcc8fae
commit
4c40b79a99
1 changed files with 99 additions and 99 deletions
|
@ -12,47 +12,49 @@ Dim sDrive, sVmrunPath
|
|||
sDrive = "\\st-vmware\vmware"
|
||||
sVmrunPath = sDrive & "\bin\vmrun.vbs"
|
||||
|
||||
If LCase(Left(oNetwork.ComputerName, 9)) = "stupid-pc" Or _
|
||||
LCase(oNetwork.ComputerName) = "ee-pc2" Then
|
||||
|
||||
' Determine vmware icon path and quit if not found (eg. vmware not installed)
|
||||
Dim sIconPath
|
||||
On Error Resume Next
|
||||
sIconPath = oShell.RegRead("HKCR\VMware.Document\DefaultIcon\")
|
||||
If Err.Number Then
|
||||
' Determine vmware icon path and quit if not found (eg. vmware not installed)
|
||||
Dim sIconPath
|
||||
On Error Resume Next
|
||||
sIconPath = oShell.RegRead("HKCR\VMware.Document\DefaultIcon\")
|
||||
If Err.Number Then
|
||||
WScript.Quit
|
||||
End If
|
||||
On Error Goto 0
|
||||
End If
|
||||
On Error Goto 0
|
||||
|
||||
' Init regexps
|
||||
Dim oReConfig
|
||||
Set oReConfig = New RegExp
|
||||
oReConfig.IgnoreCase = True
|
||||
oReConfig.Pattern = "^\s*([a-z\.0-9]*)\s*=\s*""?([^""]+)""?$"
|
||||
' Init regexps
|
||||
Dim oReConfig
|
||||
Set oReConfig = New RegExp
|
||||
oReConfig.IgnoreCase = True
|
||||
oReConfig.Pattern = "^\s*([a-z\.0-9]*)\s*=\s*""?([^""]+)""?$"
|
||||
|
||||
' Get path to users start menu
|
||||
Dim sShortcutFolder
|
||||
sShortcutFolder = oShell.SpecialFolders("StartMenu") & _
|
||||
' Get path to users start menu
|
||||
Dim sShortcutFolder
|
||||
sShortcutFolder = oShell.SpecialFolders("StartMenu") & _
|
||||
"\Programs\VMware Images"
|
||||
|
||||
' Create shortcut directory if it doesn't exist
|
||||
If Not oFS.FolderExists(sShortcutFolder) Then
|
||||
' Create shortcut directory if it doesn't exist
|
||||
If Not oFS.FolderExists(sShortcutFolder) Then
|
||||
oFS.CreateFolder(sShortcutFolder)
|
||||
End If
|
||||
End If
|
||||
|
||||
' Remove old shortcuts
|
||||
Dim oFolder, oFile
|
||||
Set oFolder = oFS.GetFolder(sShortcutFolder)
|
||||
For Each oFile In oFolder.Files
|
||||
' Remove old shortcuts
|
||||
Dim oFolder, oFile
|
||||
Set oFolder = oFS.GetFolder(sShortcutFolder)
|
||||
For Each oFile In oFolder.Files
|
||||
If Right(Lcase(oFile.Name), 4) = ".lnk" Then
|
||||
oFS.DeleteFile(oFile.Path)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
' Find image files and loop through them
|
||||
Dim oImageFolder, iTest
|
||||
Set oImageFolder = oFS.GetFolder(sDrive & "\")
|
||||
For Each oFolder In oImageFolder.SubFolders
|
||||
' Find image files and loop through them
|
||||
Dim oImageFolder, iTest
|
||||
On Error Resume Next
|
||||
Set oImageFolder = oFS.GetFolder(sDrive & "\")
|
||||
If Err.Number Then
|
||||
WScript.Quit
|
||||
End If
|
||||
On Error Goto 0
|
||||
For Each oFolder In oImageFolder.SubFolders
|
||||
On Error Resume Next
|
||||
iTest = oFolder.Files.Count
|
||||
If Err.Number = 0 Then
|
||||
|
@ -96,13 +98,13 @@ If LCase(Left(oNetwork.ComputerName, 9)) = "stupid-pc" Or _
|
|||
Else
|
||||
On Error Goto 0
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
' Fix vmware preferences.ini
|
||||
Dim sPreferences
|
||||
sPreferences = oFS.BuildPath(oShell.ExpandEnvironmentStrings("%APPDATA%"), _
|
||||
Dim sPreferences
|
||||
sPreferences = oFS.BuildPath(oShell.ExpandEnvironmentStrings("%APPDATA%"), _
|
||||
"VMware\preferences.ini")
|
||||
If Not oFS.FileExists(sPreferences) Then
|
||||
If Not oFS.FileExists(sPreferences) Then
|
||||
If Not oFS.FolderExists(oFS.GetParentFolderName(sPreferences)) Then
|
||||
oFS.CreateFolder(oFS.GetParentFolderName(sPreferences))
|
||||
End If
|
||||
|
@ -119,8 +121,6 @@ If LCase(Left(oNetwork.ComputerName, 9)) = "stupid-pc" Or _
|
|||
oFile.WriteLine("pref.componentDownloadPermission = ""deny""")
|
||||
oFile.Close
|
||||
Set oFile = Nothing
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Set oShell = Nothing
|
||||
|
|
Loading…
Add table
Reference in a new issue