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.

75 lines
2.1 KiB
Plaintext

Option Explicit
Dim strUsername,strPassword,wshshell,fso,strCommandLine,strRestrUsername,strRestrPassword
Dim strSystemFolder,strWinFolder,strTempFolder,strPath,Dlg,Fnct,key,strTemp,strNewKey
set wshshell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set Fnct = CreateObject("Install.Functions")
strPath = GetCurrentPath()
strSystemFolder = fso.GetSpecialFolder(1) & "\"
strWinFolder = fso.GetSpecialFolder(0) & "\"
strTempFolder = fso.GetSpecialFolder(2) & "\"
Const WinlogonKey = _
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
strRestrUsername = "Autologon"
If KeyExists(WinlogonKey & "\DefaultPasswordAutologon") Then
strRestrPassword = wshshell.RegRead(WinlogonKey & "\DefaultPasswordAutologon")
wshshell.RegWrite WinlogonKey & "\DefaultPassword",strRestrPassword
wshshell.RegWrite WinlogonKey & "\DefaultUserName",strRestrUsername
End If
key = "HKEY_LOCAL_MACHINE\SOFTWARE\Beckhoff\TWinCAT\System\PlcCtrlPath"
strNewKey = Key & "org"
If KeyExists(strNewKey) Then
strTemp = wshshell.RegRead(strNewKey)
wshshell.RegWrite key,strTemp
End if
key = "HKEY_LOCAL_MACHINE\SOFTWARE\Beckhoff\TWinCAT\System\SysManagerPath"
strNewKey = Key & "org"
If KeyExists(strNewKey) Then
strTemp = wshshell.RegRead(strNewKey)
wshshell.RegWrite key,strTemp
End if
key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\AdminWarn"
If KeyExists(Key) Then
wshshell.RegDelete Key
End If
Call Fnct.ExitWindows(2)
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 GetProgramFiles
Dim l_strDir
l_strDir = wshshell.ExpandEnvironmentStrings("%PROGRAMFILES%")
If l_strDir = "%PROGRAMFILES%" Then l_strDir = "C:\Program Files"
GetProgramFiles = l_strDir
End Function
Function KeyExists(p_strKey)
Dim l_strTemp
On Error Resume Next
Err.Clear
l_strTemp = wshshell.RegRead(p_strKey)
If Err.Number <> 0 Then
KeyExists = False
Else
KeyExists = True
End If
On Error Goto 0
End Function