Hi Guys I have this HTA and script that I hope to use as a quicklogin for pupils. the idea is that The PC auto logs on to as a single user on a GPO that is set for Pupils with all the restrictions sert in place. THe HTA produces a full screen on which a logon / logoff input boxes are placed. On logon the Script maps the drive to the uses work area and on logoff disconnects the drive. It all works BUT... i would like the logoff to bring up the original state, ie the full screen. also the screen should stay in place if the username/password is incorrect . I post the HTA below. if any one could point me in the right direction.
Thanks Guys.
<
<head>
<title>Bungay Middle School</title>
<HTA:APPLICATION
APPLICATIONNAME="HTALogin"
SCROLL="no"
SINGLEINSTANCE="yes"
CAPTION="NO"
ShowInTaskbar="NO"
windowstate="Maximize"
BORDER = "thin"
BorderStyle = Complex
>
</head>
<SCRIPT LANGUAGE="VBScript">
sub Window_onLoad
'Disconnect ALL mapped drives
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDrive clDrives.Item(i), True, True
next
End Sub
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj,objWMIServices, Path
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
Sub MapDrives
On Error Resume Next
Dim UserString, UserPassword, WSHNetwork
UserString = login.Value
UserPassword = password.Value
Set WSHNetwork = CreateObject("WScript.Network")
WSHNetwork.MapNetworkDrive "P:", "\\gandalf\PUPILS\" & UserString,True, UserString,UserPassword
If err then
createobject("wscript.shell").popup "CHECK USERNAME or PASSWORD", 5," LOGON FAILED" ,0+16
else
createobject("wscript.shell").popup "LOGON SUCCESSFULL", 5, "AUTHORISED USERS ONLY" ,64
End if
'Clear the boxes now that we are done using the info
login.Value = ""
password.Value =""
UserString=Nothing
UserPassword=Nothing
window.resizeTo 370,270
window.moveTo 650,490
End Sub
Sub disconnectdrives
'Disconnect ALL mapped drives
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDrive clDrives.Item(i), True, True
createobject("wscript.shell").popup "LOGGED OFF", 5, "AUTHORISED USERS ONLY" ,64
next
windowstate=maximize
End sub
</SCRIPT>
<body bgcolor="cyan"><center>
<h1><font color="BLUE" face="Times New Roman" size="6">Bungay Middle School</h1>
<table align="center">
<tr><td>User Number:</td><td><input type="text" name="login" size="5" maxsize="5"></td></tr>
<tr><td>Password:</td><td><input type="password" name="password" size="30"></td></tr>
<tr><td colspan="2" align="center"><input id=runbutton type="button" value="Logon" name="run_button"
onClick="MapDrives"></td></tr>
<tr><td colspan="4" align="center"><input id=runbutton type="button" value="logoff" name="run_button"
onClick="disconnectdrives"></td></tr>
</td></tr>
</table>
<p>
<span id = "DataArea"></span>
</center></body>
Thanks Guys.
<
<head>
<title>Bungay Middle School</title>
<HTA:APPLICATION
APPLICATIONNAME="HTALogin"
SCROLL="no"
SINGLEINSTANCE="yes"
CAPTION="NO"
ShowInTaskbar="NO"
windowstate="Maximize"
BORDER = "thin"
BorderStyle = Complex
>
</head>
<SCRIPT LANGUAGE="VBScript">
sub Window_onLoad
'Disconnect ALL mapped drives
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDrive clDrives.Item(i), True, True
next
End Sub
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj,objWMIServices, Path
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
Sub MapDrives
On Error Resume Next
Dim UserString, UserPassword, WSHNetwork
UserString = login.Value
UserPassword = password.Value
Set WSHNetwork = CreateObject("WScript.Network")
WSHNetwork.MapNetworkDrive "P:", "\\gandalf\PUPILS\" & UserString,True, UserString,UserPassword
If err then
createobject("wscript.shell").popup "CHECK USERNAME or PASSWORD", 5," LOGON FAILED" ,0+16
else
createobject("wscript.shell").popup "LOGON SUCCESSFULL", 5, "AUTHORISED USERS ONLY" ,64
End if
'Clear the boxes now that we are done using the info
login.Value = ""
password.Value =""
UserString=Nothing
UserPassword=Nothing
window.resizeTo 370,270
window.moveTo 650,490
End Sub
Sub disconnectdrives
'Disconnect ALL mapped drives
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDrive clDrives.Item(i), True, True
createobject("wscript.shell").popup "LOGGED OFF", 5, "AUTHORISED USERS ONLY" ,64
next
windowstate=maximize
End sub
</SCRIPT>
<body bgcolor="cyan"><center>
<h1><font color="BLUE" face="Times New Roman" size="6">Bungay Middle School</h1>
<table align="center">
<tr><td>User Number:</td><td><input type="text" name="login" size="5" maxsize="5"></td></tr>
<tr><td>Password:</td><td><input type="password" name="password" size="30"></td></tr>
<tr><td colspan="2" align="center"><input id=runbutton type="button" value="Logon" name="run_button"
onClick="MapDrives"></td></tr>
<tr><td colspan="4" align="center"><input id=runbutton type="button" value="logoff" name="run_button"
onClick="disconnectdrives"></td></tr>
</td></tr>
</table>
<p>
<span id = "DataArea"></span>
</center></body>