You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
3.2 KiB
Plaintext

Option Explicit
Dim wshshell,fso,i,Fnct
Dim strPath,strSystemFolder,strWinFolder,strTempFolder
'----------------------------- Objekte erzeugen --------------------------------
i = 0
On Error Resume Next
Do
err.Clear
i = i+1
Set wshshell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set Fnct = CreateObject("Install.Functions")
WScript.Sleep 1000
Loop Until Err.Number = 0 OR i > 30
If Err.Number <> 0 Then
WScript.Quit
End If
On Error Goto 0
'--------------------------- Standardpfade -------------------------------------
strPath = GetCurrentPath()
strSystemFolder = fso.GetSpecialFolder(1) & "\"
strWinFolder = fso.GetSpecialFolder(0) & "\"
strTempFolder = fso.GetSpecialFolder(2) & "\"
'------------------------------ Main -------------------------------------------
Dim Key,strFdcs
Dim strFockeDir,strTransferDir,strMainVolume
strMainVolume = ExpandPath("%MAIN_VOLUME%","c:\")
strFockeDir = ExpandPath("%FOCKEDIR%",strMainVolume & "Focke")
strTransferDir = ExpandPath("%TRANSFERDIR%","d:\Transfer")
strFdcs = ExpandPath("%FOCKEDCSDIR%",strMainVolume & "FockeDcs")
Call wshshell.Run("AddUsrGrps.exe uFM gFockeMontage Sirius ""Focke Assembly""",1,True)
Call wshshell.Run("AddUsrGrps.exe uFS gFockeService Orion ""Focke Service""",1,True)
Call wshshell.Run("AddUsrGrps.exe uCS gCustomerService Mars ""Customer""",1,True)
Call wshshell.Run("AddUsrGrps.exe uDCS gFockeDCS Pegasus ""DCS Data Access""",1,True)
Call wshshell.Run("NetShare.exe " & strFockeDir & " Focke gFockeMontage,gFockeService,gCustomerService A,A,A",1,True)
Call wshshell.Run("NetShare.exe " & strTransferDir & " Transfer gFockeMontage,gFockeService,gCustomerService A,A,A",1,True)
If fso.FolderExists(strFdcs) Then
Call wshshell.Run("NetShare.exe " & strFdcs & " FockeDCS gFockeMontage,gFockeService,gCustomerService,gFockeDCS A,A,A,R",1,True)
End If
Call wshshell.Run("chngpass.exe Administrator Leo")
wscript.Sleep(500)
Const WinlogonKey = _
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
Key = WinlogonKey & "\AutoAdminLogon"
wshshell.RegWrite Key, 1
Key = WinlogonKey & "\DefaultUserName"
wshshell.RegWrite Key, "focke"
Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Beckhoff\TwinCAT\System\Build"
If RegExists(Key) Then
If wshshell.RegRead(Key) >= 727 Then
Call wshshell.Run("chngpass.exe focke Gemini")
Key = WinlogonKey & "\DefaultPassword"
wshshell.RegWrite Key, "Gemini"
End If
End If
'------------------------------- Funktionen ------------------------------------
Function GetCurrentPath()
Dim l_strScriptName
Dim l_strTemp
l_strScriptName = WScript.ScriptFullName
l_strTemp = WScript.ScriptName
GetCurrentPath = Left(l_strScriptName, Len(l_strScriptName) - Len(l_strTemp))
End Function
Function ExpandPath(p_strEnvironment,p_strDefault)
Dim l_strTemp
l_strTemp = wshshell.ExpandEnvironmentStrings(p_strEnvironment)
If l_strTemp = p_strEnvironment Then
l_strTemp = p_strDefault
End If
ExpandPath = l_strTemp
End Function
Function RegExists(key)
Dim Dummy
On Error Resume Next
dummy = wshshell.RegRead(key)
If Err.Number = 0 Then
RegExists = True
Else
RegExists = False
Err.Clear
End If
On Error Goto 0
End Function