Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Set Argument=WScript.Arguments
- Dim Trace
- Trace=0
- if Argument.count = 1 then
- if Argument(0)="True" then
- Trace=1
- end if
- end if
- if Trace=0 then
- on error resume next
- else
- Wscript.Echo "Skript vom 15.01.2015 gestartet!"
- end if
- '------------------------------------------------------
- '----------- Konstanten -------------------------------
- Const LW_O="O:" 'QM-Archive
- Const LW_P="P:" 'Private
- Const LW_Q="Q:" 'Roth
- Const LW_R="R:" 'Buchhaltung
- Const LW_S="S:" 'Alpha-Reha
- Const LW_T="T:" 'Theorg
- Const LW_W="W:" 'Wendelstein
- Const LW_V="V:" 'Bank
- Const LW_Y="Y:" 'Starmoney
- Const LW_X="X:" 'Proxomed
- Const LW_Z="Z:" 'QM System
- Const Server1="ALPHA01"
- Const Server2="ALPHA03"
- Const Server3="ALPHA02"
- Const Server01="SERVER01" 'Roth
- Const Server02="SERVER02" 'Roth
- Const Server03="SERVER03" 'Roth
- Const Server04="SERVER04" 'Wendelstein
- Const Server05="SERVER05" 'Fürth
- Const Server06="SERVER06" 'Wendelstein
- Const US_Administrator="cn=administrator"
- Const US_HMUELLER="cn=hans müller"
- Const US_EKRUL="cn=empfang fürth"
- Const US_HBAUMGAERTEL="cn=heidi baumgärtel"
- Const GR_WENDELSTEIN="cn=wendelstein"
- Const GR_ROTH="cn=roth"
- Const GR_SCHWABACH="cn=schwabach"
- Const GR_FUERTH="cn=fuerth"
- Const GR_BUCHHALTUNG="cn=buchhaltung"
- Const GR_BANK="cn=onlinebanking"
- Const GR_NOSKRIPT="cn=noskript"
- Const PR_RH_EMPFANG="cn=pr-rh-empfang"
- Const PR_WE_EMPFANG="cn=pr-we-empfang"
- Const PR_SC_EMPFANG="cn=pr-sc-empfang"
- Const PR_RH_MTT="cn=pr-rh-medizinisches training"
- Const PR_RH_ERGO="cn=pr-rh-ergo"
- Const PR_RH_PHYSIO="cn=pr-rh-physio"
- Const PR_RH_ABRECHNUNG="cn=pr-rh-abrechnung"
- Const PR_WE_PLANUNG="cn=pr-we-planung"
- Const PR_RH_CHEFS="cn=pr-rh-geschaeftsleitung"
- Const PC_ALBRECHT="ALPHA281210"
- Const PC_TRAINING1="ALPHA261210"
- Const PC_KRUL="ALPHA030315"
- Const PC_BAUM="ALPHA130214"
- Const IP_Roth="61"
- Const IP_Wendelstein="60"
- Const IP_Schwabach="62"
- Const IP_Fuerth="63"
- '------------------------------------------------------
- '----------- Vorbereitungen ---------------------------
- Dim Ergebnis
- Set Network=CreateObject("Wscript.Network")
- Set Shell=CreateObject("Wscript.Shell")
- Set Drives=Network.EnumNetworkDrives
- Set ADSysInfo=CreateObject("ADSystemInfo")
- Set CurrentUser=GetObject("LDAP://"&ADSysInfo.Username)
- UserName=LCase(CurrentUser.Name)
- LoginName=CurrentUser.samaccountname
- if Trace=1 then Wscript.Echo "Benutzer : " & (UserName)
- Set CurrentComp=GetObject("LDAP://"&ADSysInfo.ComputerName)
- CompName=LCase(CurrentComp.Name)
- if Trace=1 then Wscript.Echo "Computer : " & (CompName)
- Select Case VarType(CurrentUser.MemberOf)
- Case 0
- UserGroups=""
- Case 8
- UserGroups=LCase(CurrentUser.MemberOf)
- Case 8204
- UserGroups=LCase(Join(CurrentUser.MemberOf))
- End Select
- 'UserGroups=LCase(Join(CurrentUser.MemberOf))
- if Trace=1 then Wscript.Echo "User Groups : " & (UserGroups)
- if CompName<>Server02 and CompName<>Server03 then
- Select Case VarType(CurrentComp.MemberOf)
- Case 0
- CompGroups=""
- Case 8
- CompGroups=LCase(CurrentComp.MemberOf)
- Case 8204
- CompGroups=LCase(Join(CurrentComp.MemberOf))
- End Select
- 'CompGroups=LCase(Join(CurrentComp.MemberOf))
- if Trace=1 then Wscript.Echo "Computer Groups : " & (CompGroups)
- end if
- if Instr(CompGroups,GR_NOSKRIPT) then
- if Trace=1 then Wscript.Echo "Abflug !"
- Wscript.Quit()
- end if
- Machine=UCase(Network.ComputerName)
- '------------------------------------------------------
- '----------- IP Adresse ermitteln ---------------------
- dim a1,a2,a3
- Set IPConfigSet = GetObject("winmgmts://.").ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
- For Each IPConfig In IPConfigSet
- if Not IsNull(IPConfig.IPAddress) Then
- For i=LBound(IPConfig.IPAddress) To UBound(IPConfig.IPAddress)
- Ergebnis=IPConfig.IPAddress(i)
- a1=instr(Ergebnis,".")
- a2=instr(a1+1,Ergebnis,".")
- a3=instr(a2+1,Ergebnis,".")
- Ergebnis1=left(Ergebnis,a2)
- if Ergebnis1="192.168."and IPConfig.IPSubnet(i)<>"64" then
- OwnIP=mid(Ergebnis,a2+1,a3-a2-1)
- if Trace=1 then Wscript.Echo ("Duooktett : " & Ergebnis1)
- end if
- if Trace=1 then Wscript.Echo "IPAdresse: " & IPConfig.IPAddress(i) & " Subnet: " & IPConfig.IPSubnet(i)
- 'if Trace=1 then WScript.Echo "Subnet: " & IPConfig.IPSubnet(i)
- 'if Trace=1 then WScript.Echo "MAC Address " & IPConfig.MACAddress
- Next
- End If
- Next
- Ergebnis=OwnIP
- if Trace=1 then WScript.Echo "IPNetz: " & Ergebnis
- '------------------------------------------------------
- '----------- Vorbereitung BFS -------------------------
- BFS="ok"
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- If objFSO.FolderExists("V:\BFSPRO") then
- BFS="ok"
- Else
- BFS="nein"
- End If
- if Trace=1 then WScript.Echo "BFS "& BFS
- '------------------------------------------------------
- '----------- Laufwerke löschen ------------------------
- for i=o to Drives.Count -1 Step 2
- if Drives.Item(i)=LW_P then
- Network.RemoveNetworkDrive LW_P,true,true
- end if
- if Drives.Item(i)=LW_R then
- Network.RemoveNetworkDrive LW_R,true,true
- end if
- if Drives.Item(i)=LW_S then
- Network.RemoveNetworkDrive LW_S,true,true
- end if
- if Drives.Item(i)=LW_T then
- Network.RemoveNetworkDrive LW_T,true,true
- end if
- if Drives.Item(i)=LW_U then
- Network.RemoveNetworkDrive LW_U,true,true
- end if
- ' if Drives.Item(i)=LW_V then
- ' Network.RemoveNetworkDrive LW_V,true,true
- ' end if
- if Drives.Item(i)=LW_Q then
- Network.RemoveNetworkDrive LW_Q,true,true
- end if
- if Drives.Item(i)=LW_O then
- Network.RemoveNetworkDrive LW_O,true,true
- end if
- if Drives.Item(i)=LW_W then
- Network.RemoveNetworkDrive LW_W,true,true
- end if
- if Drives.Item(i)=LW_X then
- Network.RemoveNetworkDrive LW_X,true,true
- end if
- if Drives.Item(i)=LW_Z then
- Network.RemoveNetworkDrive LW_Z,true,true
- end if
- next
- if Trace=1 then WScript.Echo "Laufwerke gelöscht"
- '------------------------------------------------------
- '----------- Netzwerkdrucker löschen ------------------
- strComputer = "."
- Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
- Set colInstalledPrinters = objWMIService.ExecQuery("Select * from Win32_Printer Where Network = True")
- if Trace=1 then Wscript.Echo colInstalledPrinters.count & (" Drucker installiert!")
- if Trace=1 then Wscript.Echo ("Drucker löschen Vorbereitung abgeschloßen!")
- for each objPrinter in colInstalledPrinters
- if Trace=1 then Wscript.Echo ("Delete: " & objPrinter.Caption)
- objPrinter.Delete_
- next
- if Trace=1 then Wscript.Echo ("Drucker gelöscht!")
- '------------------------------------------------------
- if Trace=1 then WScript.Echo "Standardlaufwerke gemappt"
- if Instr(UserGroups,GR_ROTH) then
- if Trace=1 then WScript.Echo "Laufwerke Roth"
- Network.MapNetworkDrive LW_S,"\\SERVER02\ALPHA-REHA"
- Network.MapNetworkDrive LW_X,"\\SERVER02\PROXOMED"
- Network.MapNetworkDrive LW_Q,"\\SERVER02\ROTH"
- if Trace=1 then WScript.Echo "\\SERVER02\BENUTZER\" & Loginname
- Network.MapNetworkDrive LW_P,"\\SERVER02\BENUTZER\"&Loginname
- Network.MapNetworkDrive LW_Z,"\\SERVER02\QM-ROTH"
- Network.MapNetworkDrive LW_O,"\\SERVER02\QM-ROTH ARCHIV"
- if Trace=1 then WScript.Echo "Laufwerke verbunden"
- if Instr(UserGroups,GR_BANK) then
- if Trace=1 then WScript.Echo "Bank"
- if BFS="nein" then
- Network.MapNetworkDrive LW_V,"\\SERVER01\BANK", true
- Network.MapNetworkDrive LW_Y,"\\SERVER01\STARMONEY", true
- end if
- if Trace=1 then WScript.Echo "Laufwerke Bank verbunden"
- end if
- if Instr(UserGroups,GR_BUCHHALTUNG) then
- if Trace=1 then WScript.Echo "Buchhaltung"
- Network.MapNetworkDrive LW_R,"\\SERVER02\BUCHHALTUNG"
- Network.MapNetworkDrive LW_W,"\\SERVER04\WENDELSTEIN"
- if Trace=1 then WScript.Echo "Laufwerke Buchhaltung verbunden"
- end if
- Batch="reg import \\SERVER01\ROTH\SharedDocuments.reg"
- if Trace=1 then WScript.Echo Batch
- Aus=Shell.Run(Batch,0,true)
- end if
- if Instr(UserGroups,GR_WENDELSTEIN) then
- if Trace=1 then WScript.Echo "Wendelstein"
- Network.MapNetworkDrive LW_S,"\\SERVER02\ALPHA-REHA"
- Network.MapNetworkDrive LW_W,"\\SERVER04\WENDELSTEIN"
- Network.MapNetworkDrive LW_P,"\\SERVER04\BENUTZER\"&Network.Username
- Network.MapNetworkDrive LW_Z,"\\SERVER04\QM-WENDELSTEIN"
- Network.MapNetworkDrive LW_O,"\\SERVER04\QM-WENDELSTEIN ARCHIV"
- if Trace=1 then WScript.Echo "Laufwerke verbunden"
- if Instr(UserGroups,GR_BUCHHALTUNG) then
- if Trace=1 then WScript.Echo "Buchhaltung"
- Network.MapNetworkDrive LW_R,"\\SERVER02\BUCHHALTUNG"
- Network.MapNetworkDrive LW_Q,"\\SERVER02\ROTH"
- if Trace=1 then WScript.Echo "Laufwerke Buchhaltung verbunden"
- end if
- Batch="reg import \\SERVER04\WENDELSTEIN\SharedDocuments.reg"
- if Trace=1 then WScript.Echo Batch
- Aus=Shell.Run(Batch,0,true)
- end if
- if Instr(UserGroups,GR_FUERTH) then
- if Trace=1 then WScript.Echo "Fürth"
- Network.MapNetworkDrive LW_O,"\\SERVER05\FUERTH"
- Network.MapNetworkDrive LW_P,"\\SERVER05\BENUTZER\"&Network.Username
- if Trace=1 then WScript.Echo "Laufwerke verbunden"
- end if
- if (Machine<>SERVER1 and Machine<>SERVER2 and Machine<>SERVER3 and Machine<>SERVER01 and Machine<>SERVER02 and Machine<>SERVER03 and Machine<>SERVER04 and Machine<>SERVER05) then
- if Trace=1 then WScript.Echo "Kein Server"
- if Instr(UserGroups,GR_ROTH) then
- if Trace=1 then WScript.Echo "Drucker Roth ohne Server"
- Network.MapNetworkDrive LW_T,"\\SERVER02\THEORG"
- if Instr(UserGroups,PR_RH_EMPFANG) then
- if Trace=1 then WScript.Echo "Drucker Empfang"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach1"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach2(A5)"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach3"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach4"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_A6"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-MTT"
- Network.SetDefaultPrinter "\\SERVER02\RH-EMPFANG_Fach1"
- if Trace=1 then WScript.Echo "Drucker Roth Empfang verbunden"
- end if
- if Instr(UserGroups,PR_RH_MTT) then
- if Machine=PC_TRAINING1 then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG"
- Network.SetDefaultPrinter "\\SERVER02\RH-EMPFANG_Fach1"
- else
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-MTT"
- Network.SetDefaultPrinter "\\SERVER02\RH-MTT"
- end if
- if Trace=1 then WScript.Echo "Drucker MTT verbunden"
- end if
- if Instr(UserGroups,PR_RH_ERGO) then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach1"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach2(A5)"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach3"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach4"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_A6"
- Network.SetDefaultPrinter "\\SERVER02\RH-EMPFANG_Fach1"
- if Trace=1 then WScript.Echo "Drucker Ergo verbunden"
- end if
- if Instr(UserGroups,PR_RH_PHYSIO) then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach1"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach2(A5)"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach3"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach4"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_A6"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-PHYSIO"
- Network.SetDefaultPrinter "\\SERVER02\RH-PHYSIO"
- if Trace=1 then WScript.Echo "Drucker Physio verbunden"
- end if
- if Instr(UserGroups,PR_RH_ABRECHNUNG) then
- if Ergebnis=IP_Roth then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-ABRECHNUNG"
- if Machine<>PC_ALBRECHT then
- Network.SetDefaultPrinter "\\SERVER02\RH-ABRECHNUNG"
- end if
- if Trace=1 then WScript.Echo "Drucker Abrechnung Roth in Roth"
- end if
- end if
- if Instr(UserGroups,PR_RH_CHEFS) then
- if Ergebnis=IP_Roth then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-ABRECHNUNG"
- if Trace=1 then WScript.Echo "Drucker Chefs Roth in Roth"
- end if
- end if
- end if
- if Instr(UserGroups,GR_WENDELSTEIN) then
- if Trace=1 then WScript.Echo "Wendelstein"
- Network.MapNetworkDrive LW_T,"\\SERVER04\THEORG"
- if Instr(UserGroups,PR_WE_EMPFANG) then
- Network.AddWindowsPrinterConnection "\\SERVER04\WE-EMPFANG"
- Network.AddWindowsPrinterConnection "\\SERVER04\WE-PLANUNG"
- Network.SetDefaultPrinter "\\SERVER04\WE-EMPFANG"
- if Trace=1 then WScript.Echo "Drucker Wendelstein Empfang verbunden"
- end if
- if Instr(UserGroups,PR_WE_PLANUNG) then
- Network.AddWindowsPrinterConnection "\\SERVER04\WE-EMPFANG"
- Network.AddWindowsPrinterConnection "\\SERVER04\WE-PLANUNG"
- Network.SetDefaultPrinter "\\SERVER04\WE-PLANUNG"
- if Trace=1 then WScript.Echo "Drucker Planung verbunden"
- end if
- if Instr(UserGroups,PR_WE_ABRECHNUNG) or Instr(UserGroups,PR_RH_ABRECHNUNG) then
- if Ergebnis=IP_Wendelstein then
- Network.AddWindowsPrinterConnection "\\SERVER04\WE-PLANUNG"
- Network.SetDefaultPrinter "\\SERVER04\WE-PLANUNG"
- if Trace=1 then WScript.Echo "Drucker Planung Wendelstein in Wendelstein"
- end if
- if Ergebnis=IP_Roth then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-ABRECHNUNG"
- Network.SetDefaultPrinter "\\SERVER02\RH-ABRECHNUNG"
- if Trace=1 then WScript.Echo "Drucker Abrechnung Wendelstein in Roth"
- end if
- end if
- end if
- if Instr(UserGroups,GR_FUERTH) then
- if Trace=1 then WScript.Echo "Fürth"
- Network.MapNetworkDrive LW_T,"\\SERVER05\THEORG"
- if Machine=PC_KRUL then
- Network.AddWindowsPrinterConnection "\\ALPHA140214\EK-MFC7321"
- Network.SetDefaultPrinter "\\ALPHA140214\EK-MFC7321"
- end if
- end if
- else
- if Trace=1 then WScript.Echo "Am Server " & Ergebnis2
- if Trace=1 then WScript.Echo Machine
- if Machine=SERVER02 then
- if Instr(UserGroups,GR_ROTH) then
- if Trace=1 then WScript.Echo "Drucker Roth am TS in Roth für Gruppe Roth"
- Network.MapNetworkDrive LW_T,"\\SERVER02\THEORG"
- if Instr(UserGroups,PR_RH_EMPFANG) then
- Network.SetDefaultPrinter "RH-EMPFANG"
- if Trace=1 then WScript.Echo "Drucker RH-Empfang am Server02 für RH-Empfang verbunden"
- end if
- if Instr(UserGroups,PR_RH_MTT) then
- 'Network.AddWindowsPrinterConnection "\\SERVER02\RH-MTT"
- Network.SetDefaultPrinter "RH-MTT"
- if Trace=1 then WScript.Echo "Drucker RH-MTT am Server02 für RH-MTT verbunden"
- end if
- if Instr(UserGroups,PR_RH_ERGO) then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach1"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach2(A5)"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach3"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach4"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_A6"
- Network.SetDefaultPrinter "RH-EMPFANG_Fach1"
- if Trace=1 then WScript.Echo "Drucker RH-Ergo am Server02 für RH-Ergo verbunden"
- end if
- if Instr(UserGroups,PR_RH_PHYSIO) then
- 'Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG"
- 'Network.AddWindowsPrinterConnection "\\SERVER02\RH-PHYSIO"
- Network.SetDefaultPrinter "RH-PHYSIO"
- if Trace=1 then WScript.Echo "Drucker RH-Physio am Server02 für RH-Physio verbunden"
- end if
- if Instr(UserGroups,PR_RH_ABRECHNUNG) then
- 'Network.AddWindowsPrinterConnection "\\SERVER02\RH-ABRECHNUNG"
- Network.SetDefaultPrinter "RH-ABRECHNUNG"
- if Trace=1 then WScript.Echo "Drucker RH-Abrechnung am Server02 für RH-Abrechnung verbunden"
- end if
- end if
- if Instr(UserGroups,GR_WENDELSTEIN) then
- if Trace=1 then WScript.Echo "Drucker Roth am TS in Roth für Gruppe Wendelstein"
- Network.MapNetworkDrive LW_T,"\\SERVER02\THEORG"
- if Instr(UserGroups,PR_RH_ABRECHNUNG) then
- 'Network.AddWindowsPrinterConnection "\\SERVER02\RH-ABRECHNUNG"
- 'Network.AddWindowsPrinterConnection "\\SERVER02\RH-MTT"
- Network.SetDefaultPrinter "RH-ABRECHNUNG"
- if Trace=1 then WScript.Echo "Drucker RH-Abrechnung am Server02 für RH-Abrechnung verbunden"
- end if
- end if
- if (UserName<>US_Administrator) then
- Batch="Taskkill /FI " & CHR(34) & "USERNAME eq " & LoginName & CHR(34) & " /IM explorer.exe /F"
- if Trace=1 then WScript.Echo Batch
- Ergebnis=Shell.Run(Batch,0,true)
- Batch="T:\START.BAT"
- Ergebnis=Shell.Run(Batch,0,true)
- if Trace=1 then WScript.Echo "Hab' gewartet!"
- Batch="shutdown /l /f"
- Ergebnis=Shell.Run(Batch,0,true)
- end if
- end if
- if Machine=SERVER04 then
- if Instr(UserGroups,GR_ROTH) then
- if Trace=1 then WScript.Echo "Drucker Roth am TS in Wendelstein für Gruppe Roth"
- Network.MapNetworkDrive LW_T,"\\SERVER04\THEORG"
- if Instr(UserGroups,PR_RH_ABRECHNUNG) then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-ABRECHNUNG"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-REZEPTE"
- Network.SetDefaultPrinter "\\SERVER02\RH-ABRECHNUNG"
- if Trace=1 then WScript.Echo "Drucker RH-Abrechnung am Server04 für RH-Abrechnung verbunden"
- end if
- end if
- if Instr(UserGroups,GR_WENDELSTEIN) then
- if Trace=1 then WScript.Echo "Drucker Wendelstein am TS in Wendelstein für Gruppe Wendelstein"
- Network.MapNetworkDrive LW_T,"\\SERVER04\THEORG"
- if Instr(UserGroups,PR_WE_PLANUNG) then
- 'Network.AddWindowsPrinterConnection "\\SERVER04\WE-PLANUNG"
- 'Network.AddWindowsPrinterConnection "\\SERVER04\WE-EMPFANG"
- Network.SetDefaultPrinter "WE-PLANUNG"
- if Trace=1 then WScript.Echo "Drucker WE-Planung am Server04 für WE-Planung verbunden"
- end if
- if Instr(UserGroups,PR_WE_EMPFANG) then
- 'Network.AddWindowsPrinterConnection "\\SERVER04\WE-EMPFANG"
- Network.SetDefaultPrinter "WE-EMPFANG"
- if Trace=1 then WScript.Echo "Drucker WE-Empfang am Server04 für WE-Empfang verbunden"
- end if
- end if
- if (UserName<>US_Administrator) then
- Batch="Taskkill /FI " & CHR(34) & "USERNAME eq " & LoginName & CHR(34) & " /IM explorer.exe /F"
- if Trace=1 then WScript.Echo Batch
- Ergebnis=Shell.Run(Batch,0,true)
- Batch="T:\START.BAT"
- Ergebnis=Shell.Run(Batch,0,true)
- if Trace=1 then WScript.Echo "Hab' gewartet!"
- Batch="shutdown /l /f"
- Ergebnis=Shell.Run(Batch,0,true)
- end if
- end if
- if Machine<>SERVER02 and Machine<>SERVER04 then
- Set WTS = Wscript.CreateObject("WTSManager.Shell")
- '------------------------------------------------------
- '----------- IP Adresse des TS-Clients ermitteln ------
- TSIp=WTS.MyIPAddress
- Ergebnis2=TSIp
- if Trace=1 then Wscript.Echo ("IP Adresse : " & Ergebnis2)
- if Ergebnis2<>"" then
- if Trace=1 then Wscript.Echo "IPAdresse der TS Clients:" & Ergebnis2
- a1=instr(Ergebnis2,".")
- a2=instr(a1+1,Ergebnis2,".")
- a3=instr(a2+1,Ergebnis2,".")
- Ergebnis1=left(Ergebnis2,a2)
- if Ergebnis1="192.168." then
- OwnTSIP=mid(Ergebnis2,a2+1,a3-a2-1)
- if Trace=1 then Wscript.Echo ("Duooktett : " & Ergebnis1)
- end if
- End if
- Ergebnis2=OwnTSIP
- if Trace=1 then WScript.Echo "TSIPNetz: " & Ergebnis2
- '- In Roth -------------------------------------------------------------------
- if Ergebnis2=IP_Roth then
- if Trace=1 then WScript.Echo "TS Client in Roth"
- '- Alpha03 -------------------------------------------------------------------
- if Machine=SERVER2 or Machine=SERVER02 then
- if Trace=1 then WScript.Echo "Drucker Roth am Server Alpha03"
- Network.MapNetworkDrive LW_T,"\\SERVER02\THEORG"
- if Instr(UserGroups,PR_RH_EMPFANG) then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach1"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach2(A5)"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach3"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach4"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_A6"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-MTT"
- Network.SetDefaultPrinter "\\SERVER02\RH-EMPFANG_Fach1"
- if Trace=1 then WScript.Echo "Drucker RH-Empfang am Server Alpha03 für RH-Empfang verbunden"
- end if
- if Instr(UserGroups,PR_RH_MTT) then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-MTT"
- Network.SetDefaultPrinter "\\SERVER012RH-MTT"
- if Trace=1 then WScript.Echo "Drucker RH-MTT am Server Alpha03 für RH-MTT verbunden"
- end if
- if Instr(UserGroups,PR_RH_ERGO) then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach1"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach2(A5)"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach3"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach4"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_A6"
- Network.SetDefaultPrinter "\\SERVER02\RH-EMPFANG_Fach1"
- if Trace=1 then WScript.Echo "Drucker RH-Ergo am Server Alpha03 für RH-Ergo verbunden"
- end if
- if Instr(UserGroups,PR_RH_PHYSIO) then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach1"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach2(A5)"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach3"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_Fach4"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG_A6"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-PHYSIO"
- Network.SetDefaultPrinter "\\SERVER02\RH-PHYSIO"
- if Trace=1 then WScript.Echo "Drucker RH-Physio am Server Alpha03 für RH-Physio verbunden"
- end if
- if Instr(UserGroups,PR_RH_ABRECHNUNG) then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-ABRECHNUNG"
- Network.SetDefaultPrinter "\\SERVER02\RH-ABRECHNUNG"
- if Trace=1 then WScript.Echo "Drucker RH-Abrechnung am Server Alpha03 für RH-Abrechnung verbunden"
- end if
- end if
- '- Alpha01 -------------------------------------------------------------------
- if Machine=SERVER1 then
- if Trace=1 then WScript.Echo "Drucker Roth am Server Alpha01"
- Network.MapNetworkDrive LW_T,"\\SERVER04\THEORG"
- if Instr(UserGroups,PR_RH_ABRECHNUNG) then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-ABRECHNUNG"
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-REZEPTE"
- Network.SetDefaultPrinter "\\SERVER02\RH-ABRECHNUNG"
- if Trace=1 then WScript.Echo "Drucker RH-Abrechnung am Server Alpha01 für RH-Abrechnung verbunden"
- end if
- if Instr(UserGroups,PR_RH_EMPFANG) then
- Network.AddWindowsPrinterConnection "\\SERVER02\RH-EMPFANG"
- Network.SetDefaultPrinter "\\SERVER02\RH-EMPFANG"
- if Trace=1 then WScript.Echo "Drucker RH-Empfang am Server Alpha03 für RH-Empfang verbunden"
- end if
- end if
- end if
- '- In Wendelstein ------------------------------------------------------------
- if Ergebnis2=IP_Wendelstein then
- if Trace=1 then WScript.Echo "TS Client in Wendelstein"
- '- Alpha01 -------------------------------------------------------------------
- if Machine=SERVER1 then
- if Trace=1 then WScript.Echo "Drucker Wendelstein am Server Alpha01"
- Network.MapNetworkDrive LW_T,"\\SERVER04\THEORG"
- if Instr(UserGroups,PR_WE_EMPFANG) then
- Network.SetDefaultPrinter "WE-EMPFANG"
- if Trace=1 then WScript.Echo "Drucker WE-Empfang am Server Alpha01 für WE-Empfang verbunden"
- end if
- if Instr(UserGroups,PR_WE_PLANUNG) then
- Network.SetDefaultPrinter "WE-PLANUNGSBUERO"
- if Trace=1 then WScript.Echo "Drucker WE-Planung am Server Alpha01 für WE-Planungsbüro verbunden"
- end if
- if Instr(UserGroups,PR_RH_ABRECHNUNG) then
- Network.SetDefaultPrinter "WE-ABRECHNUNG"
- if Trace=1 then WScript.Echo "Drucker WE-Abrechnung am Server Alpha01 für RH-Abrechnung verbunden"
- end if
- end if
- '- Alpha03 -------------------------------------------------------------------
- if Machine=SERVER2 or Machine=SERVER02 then
- if Trace=1 then WScript.Echo "Drucker Wendelstein am Server Alpha03"
- Network.MapNetworkDrive LW_T,"\\Alpha03\Theorg"
- if Instr(UserGroups,PR_WE_ABRECHNUNG) then
- 'Network.AddWindowsPrinterConnection "\\ALPHA01\WE-ABRECHNUNG"
- Network.SetDefaultPrinter "WE-ABRECHNUNG"
- if Trace=1 then WScript.Echo "Drucker WE-Abrechnung am Server Alpha03 für WE-Abrechnung verbunden"
- end if
- if Instr(UserGroups,PR_RH_ABRECHNUNG) then
- Network.AddWindowsPrinterConnection "\\ALPHA01\WE-ABRECHNUNG"
- Network.SetDefaultPrinter "\\ALPHA01\WE-ABRECHNUNG"
- if Trace=1 then WScript.Echo "Drucker WE-Abrechnung am Server Alpha03 für RH-Abrechnung verbunden"
- end if
- if Instr(UserGroups,PR_WE_EMPFANG) then
- Network.AddWindowsPrinterConnection "\\ALPHA01\WE-EMPFANG"
- Network.SetDefaultPrinter "\\ALPHA01\WE-EMPFANG"
- if Trace=1 then WScript.Echo "Drucker WE-Wendelstein am Server Alpha03 für WE-Empfang verbunden"
- end if
- end if
- '- Alpha02 -------------------------------------------------------------------
- if Machine=SERVER3 then
- if Trace=1 then WScript.Echo "Drucker Wendelstein am Server Alpha02"
- Network.MapNetworkDrive LW_T,"\\ALPHA02\THEORG"
- if Instr(UserGroups,PR_WE_ABRECHNUNG) then
- Network.AddWindowsPrinterConnection "\\ALPHA01\WE-ABRECHNUNG"
- Network.SetDefaultPrinter "\\ALPHA01\WE-ABRECHNUNG"
- if Trace=1 then WScript.Echo "Drucker WE-Abrechnung am Server Alpha02 für WE-Abrechnung verbunden"
- end if
- end if
- end if
- '- In Fürth --------------------------------------------------------------
- if Machine=SERVER05 then
- if Trace=1 then WScript.Echo "TS Client in Fürth"
- '- Server05 -------------------------------------------------------------------
- if Machine=SERVER05 and UserName<>US_Administrator then
- if Trace=1 then WScript.Echo "Fürth am Server Server05"
- Network.MapNetworkDrive LW_T,"\\SERVER05\THEORG"
- if UserName=US_HMUELLER then
- if Trace=1 then WScript.Echo "Drucker für AP H.Müller"
- Network.AddWindowsPrinterConnection "\\ALPHA150214\HM-HL2140"
- Network.SetDefaultPrinter "\\ALPHA150214\HM-HL2140"
- end if
- if UserName=US_EKRUL then
- if Trace=1 then WScript.Echo "Drucker für AP E.Krul"
- Network.AddWindowsPrinterConnection "\\ALPHA140214\EK-MFC7321"
- Network.SetDefaultPrinter "\\ALPHA140214\EK-MFC7321"
- end if
- if UserName=US_HBAUMGAERTEL then
- if Trace=1 then WScript.Echo "Drucker für AP H.Baumgärtel"
- Network.AddWindowsPrinterConnection "\\ALPHA130214\HB-HL2140"
- Network.SetDefaultPrinter "\\ALPHA130214\HB-HL21401"
- end if
- end if
- end if
- if (UserName<>US_Administrator) then
- Batch="Taskkill /FI " & CHR(34) & "USERNAME eq " & LoginName & CHR(34) & " /IM explorer.exe /F"
- if Trace=1 then WScript.Echo Batch
- Ergebnis=Shell.Run(Batch,0,true)
- Batch="T:\START.BAT"
- Ergebnis=Shell.Run(Batch,0,true)
- end if
- end if
- end if
- if Trace=1 then WScript.Echo "Login Script beendet"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement