Belphegory
IS-IT--Management
Hi there.
I am a network guy so this programming stuff is way over my poor head and need to ask the professionals.
I have vbs scripts that run in a GPO under a certain OU per department etc etc and now that we are moving to citrix, I need the normal domain login scripts to run if computername is NOT ctx...
Anyhoo, my issue is that its now working too well...nothing runs\happens on either citrix sessions or normal login.
The only thing I have changed/fiddled with is under Main Process.
It used to be only:
GrpMeb UserName
ShowBox
Wscript.Quit
I have cobbled together whats in there now from browsing this great forum, but alas its still not working.
Any help would be muchly appreciated.
Here is the whole sordid thing:
'**********************************************************************************
' Set Environment Variables
'*********************************************************************************
Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set WSHShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
Domain = WSHNetwork.UserDomain
UserName = ""
While UserName = ""
UserName = WSHNetwork.UserName
MyGroups = GetGroups(Domain, UserName)
Wend
'*********************************************************************************
' Main Process:
'*********************************************************************************
Dim WshShell, objEnv, strComputerName, str2Search4
Set WshShell = CreateObject("Wscript.Shell")
Set objEnv = WshShell.Environment("PROCESS")
strComputerName = objEnv("COMPUTERNAME")
str2Search4 = "ctx"
If strComputerName <> "" Then
If InStr(CStr(Trim(LCase(strComputerName))), str2Search4) = 0 Then
GrpMeb UserName
ShowBox
End If
End If
Set objEnv = Nothing
Set WshShell = Nothing
Wscript.Quit
'*********************************************************************************
'Function: GetGroups
'*********************************************************************************
Function GetGroups(Domain, UserName)
Set objUser = GetObject("WinNT://" & Domain & "/" & UserName)
GetGroups=""
For Each objGroup In objUser.Groups
GetGroups=GetGroups & "[" & UCase(objGroup.Name) & "]"
Next
End Function
'********************************************************************************
'Function: InGroup
'********************************************************************************
Function InGroup(strGroup)
InGroup=False
If InStr(MyGroups,"[" & UCase(strGroup) & "]") Then
InGroup=True
End If
End Function
'*********************************************************************************
' MapDrives Subroutine
'*********************************************************************************
Sub MapDrive(sDrive,sShare)
On Error Resume Next
WSHNetwork.RemoveNetworkDrive sDrive, 1, 1
wscript.sleep 1000
Err.Clear
WSHNetwork.MapNetworkDrive sDrive,sShare
End Sub
'********************************************************************************
'Map Drives:
'********************************************************************************
Sub GrpMeb(UNAME)
MapDrive "G:", "\\jhb-DC\General$"
MapDrive "T:", "\\jhb-DC\Inbound"
Return = WSHShell.Run("\\jhb-DC\ofcscan\autopcc.exe", 5, true)
Return = WSHShell.Run("\\jhb-DC\AN\ina32.exe", 5, true)
strCmd = "net.exe time \\jhb-DC /set /yes"
WshShell.Run strCmd, 0
End Sub
'
'********************************************************************************
'Display Dialog:
'********************************************************************************
Sub ShowBox
strMsgtxt = "You are mapped to the following drive letters:" & vbNewLine
strMsgtxt = strMsgtxt & "G: = \\jhb-DC\General$" & vbNewLine
strMsgtxt = strMsgtxt & "T: = \\jhb-DC\Inbound" & vbNewLine
msgbox = WshShell.Popup(strMsgtxt, 2, "Logon Script", 0)
End Sub
'********************************************************************************
I am a network guy so this programming stuff is way over my poor head and need to ask the professionals.
I have vbs scripts that run in a GPO under a certain OU per department etc etc and now that we are moving to citrix, I need the normal domain login scripts to run if computername is NOT ctx...
Anyhoo, my issue is that its now working too well...nothing runs\happens on either citrix sessions or normal login.
The only thing I have changed/fiddled with is under Main Process.
It used to be only:
GrpMeb UserName
ShowBox
Wscript.Quit
I have cobbled together whats in there now from browsing this great forum, but alas its still not working.
Any help would be muchly appreciated.
Here is the whole sordid thing:
'**********************************************************************************
' Set Environment Variables
'*********************************************************************************
Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set WSHShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
Domain = WSHNetwork.UserDomain
UserName = ""
While UserName = ""
UserName = WSHNetwork.UserName
MyGroups = GetGroups(Domain, UserName)
Wend
'*********************************************************************************
' Main Process:
'*********************************************************************************
Dim WshShell, objEnv, strComputerName, str2Search4
Set WshShell = CreateObject("Wscript.Shell")
Set objEnv = WshShell.Environment("PROCESS")
strComputerName = objEnv("COMPUTERNAME")
str2Search4 = "ctx"
If strComputerName <> "" Then
If InStr(CStr(Trim(LCase(strComputerName))), str2Search4) = 0 Then
GrpMeb UserName
ShowBox
End If
End If
Set objEnv = Nothing
Set WshShell = Nothing
Wscript.Quit
'*********************************************************************************
'Function: GetGroups
'*********************************************************************************
Function GetGroups(Domain, UserName)
Set objUser = GetObject("WinNT://" & Domain & "/" & UserName)
GetGroups=""
For Each objGroup In objUser.Groups
GetGroups=GetGroups & "[" & UCase(objGroup.Name) & "]"
Next
End Function
'********************************************************************************
'Function: InGroup
'********************************************************************************
Function InGroup(strGroup)
InGroup=False
If InStr(MyGroups,"[" & UCase(strGroup) & "]") Then
InGroup=True
End If
End Function
'*********************************************************************************
' MapDrives Subroutine
'*********************************************************************************
Sub MapDrive(sDrive,sShare)
On Error Resume Next
WSHNetwork.RemoveNetworkDrive sDrive, 1, 1
wscript.sleep 1000
Err.Clear
WSHNetwork.MapNetworkDrive sDrive,sShare
End Sub
'********************************************************************************
'Map Drives:
'********************************************************************************
Sub GrpMeb(UNAME)
MapDrive "G:", "\\jhb-DC\General$"
MapDrive "T:", "\\jhb-DC\Inbound"
Return = WSHShell.Run("\\jhb-DC\ofcscan\autopcc.exe", 5, true)
Return = WSHShell.Run("\\jhb-DC\AN\ina32.exe", 5, true)
strCmd = "net.exe time \\jhb-DC /set /yes"
WshShell.Run strCmd, 0
End Sub
'
'********************************************************************************
'Display Dialog:
'********************************************************************************
Sub ShowBox
strMsgtxt = "You are mapped to the following drive letters:" & vbNewLine
strMsgtxt = strMsgtxt & "G: = \\jhb-DC\General$" & vbNewLine
strMsgtxt = strMsgtxt & "T: = \\jhb-DC\Inbound" & vbNewLine
msgbox = WshShell.Popup(strMsgtxt, 2, "Logon Script", 0)
End Sub
'********************************************************************************