Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <!--Hides all basic windows GUI functions such as Taskbar and Close button -->
- <HTA:APPLICATION
- APPLICATIONNAME="LOGIN"
- VERSION="1.0"
- BORDER="none"
- INNERBORDER="no"
- CAPTION="no"
- SYSMENU="no"
- MAXIMIZEBUTTON="no"
- MINIMIZEBUTTON="no"
- ICON="NO"
- SCROLL="no"
- SCROLLFLAT="yes"
- SINGLEINSTANCE="yes"
- WINDOWSTATE="maximize"
- SHOWINTASKBAR="no"
- CONTEXTMENU="no"
- SELECTION="no"/>
- <script language="VBScript">
- Set objShell = CreateObject("WScript.Shell")
- Set fso = CreateObject("Scripting.FileSystemObject")
- System = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\"
- DisableTaskMgr
- dim currentDir : currentDir = objShell.CurrentDirectory 'Finds the scripts current directory'
- 'TO DO: Check whether UserName method below can be used over network'
- UserName = objShell.ExpandEnvironmentStrings("%USERNAME%") 'Grabs the username of the current user'
- pathToConfig = currentDir & "/config.ini"
- pathToKeyFile = "C:/sys/"
- 'Gets the current version number from config file'
- If fso.FileExists(pathToConfig) Then 'Makes sure that the config file exists'
- Set ConfigFile = fso.GetFile(pathToConfig) 'Config file contains only the version number'
- If ConfigFile.Size > 0 Then 'This makes sure that there is a version number set inside the config file'
- Set versionFile = fso.OpenTextFile(pathToConfig, 1)
- Version = versionFile.ReadAll
- Else
- EnableTaskMgr
- window.close 'If config file cannot be reached then the script will end prematurely and will be shown next time the user logs in once the config file can be reached.'
- End If
- Else
- window.close
- End If
- On Error Resume Next
- versionFile.close
- 'Searches C:/sys/ for keyfile'
- If fso.FileExists(pathToKeyFile & Version) Then
- EnableTaskMgr
- window.close
- Else
- End If
- sub Postpone
- ChkOne = pathToKeyFile & Version & "-1"
- ChkTwo = pathToKeyFile & Version & "-2"
- ChkThree = pathToKeyFile & Version & "-3"
- If fso.FileExists(ChkThree) Then
- 'Call Javascript for disabling postpone button'
- MsgBox "Maximum number of Postpone attempts used. You must now choose to either Accept or Decline the Policy."
- ElseIf fso.FileExists(ChkTwo) Then
- 'Delete file ChkTwo - Create file ChkThree'
- fso.DeleteFile(ChkTwo)
- Set objFile = fso.CreateTextFile(ChkThree)
- window.close
- ElseIf fso.FileExists(ChkOne) Then
- 'Delete file ChkOne - Create file ChkTwo'
- fso.DeleteFile(ChkOne)
- Set objFile = fso.CreateTextFile(ChkTwo)
- window.close
- Else
- 'Create file ChkOne'
- Set objFile = fso.CreateTextFile(ChkOne)
- window.close
- End If
- end sub
- sub DisableTaskMgr
- objShell.RegWrite System, "REG_SZ"
- objShell.RegWrite System & "/DisableTaskMgr", 1, "REG_DWORD"
- end sub
- sub EnableTaskMgr
- objShell.RegWrite System, "REG_SZ"
- objShell.RegWrite System & "/DisableTaskMgr", 0, "REG_DWORD"
- end sub
- sub Logon 'Method only runs when user clicks "I Accept"'
- On Error Resume Next
- Call EnableTaskMgr
- If Not (fso.FileExists(currentDir & "/store/" & LCase(UserName) & ".csv")) Then
- On Error Resume Next
- Set objFile = fso.CreateTextFile(currentDir & "/store/" & LCase(UserName) & ".csv", True)
- objFile.close
- Else
- End If
- Set objCSVFile = fso.OpenTextFile(currentDir & "/store/" & UserName & ".csv", 2, True)
- objCSVFile.Write(UserName & "," & Now & "," & Version)
- objCSVFile.Close
- On Error Resume Next
- fso.CreateTextFile("C:/sys/" & Version)
- window.close
- end sub
- sub Logoff 'Method only runs when user clicks "I Decline"'
- objShell.Run "shutdown /l"
- end sub
- </script>
- <script type="text/javascript">
- function checkfile()
- {
- var fileLocation = "C:/sys/"
- var regex = new RegExp('\w+\-3');
- if(fso.FileExists(fileLocation + regex)) {
- alert("File found successfully");
- } else {
- alert("File not found.");
- }
- }
- window.onload = checkfile;
- </script>
- <style type="text/css">
- body{margin:40px;font-family:Arial}hr{margin-bottom:15px;height:1px;background-color:#004c99}.title{margin-bottom:16px;font-size:18px}img{width:199px;height:71.5px;margin-bottom:75px}.main_text{margin-bottom:20px}.button{float:right;margin-left:10px;background-color:#00265D;border:1px solid #004c99;display:inline-block;color:#fff;font-family:arial;font-size:15px;font-weight:700;padding:9px 25px;text-decoration:none;cursor:pointer}
- </style>
- </head>
- <body>
- <img src="assets/NG-Bailey.png" alt="Company Logo">
- <div class="title">Relevant End User Licence Agreement</div>
- <hr>
- <object data="assets/policy.pdf" type="application/pdf" width="100%" height="60%" alt="End User License Agreement">If you cannot see the above document, please contact the IT Service Desk</object>
- <hr>
- <h6>If you cannot see the above document, please contact the IT Service Desk</h6>
- <h4>By clicking "I Accept" you are agreeing to the above document.</h4>
- <div>
- <a href onClick="Logoff" class="button">I Decline</a>
- </div>
- <div>
- <a href onClick="Logon" class="button">I Accept</a>
- </div>
- <div>
- <a href onClick="Postpone" class="button" id="btnPostpone">Postpone</a>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement