• RSS
  • Twitter
  • FaceBook

Welcome to ISAserver.org

Forums | Register | Login | My Profile | Inbox | RSS RSS icon | My Subscription | My Forums | Address Book | Member List | Search | FAQ | Ticket List | Log Out

howto add pcs to computerset with ASP(vbscript)

Users viewing this topic: none

Logged in as: Guest
  Printable Version
All Forums >> [ISA Server 2004 Misc.] >> ISA Server 2004 Programming >> howto add pcs to computerset with ASP(vbscript) Page: [1]
Login
Message << Older Topic   Newer Topic >>
howto add pcs to computerset with ASP(vbscript) - 17.Jun.2005 9:20:00 AM   
browolf

 

Posts: 15
Joined: 11.Feb.2005
Status: offline
the ip log files are created from a line in the login script that says:

ipconfig | find "IP Address" > \\isaproxy\logs$\ips\%computername%.txt

this script is called from a previous page in the form

rooms.asp?room=<room>

where <room> is a computer name prefix.

code:
<%
Const ForReading = 1
dim root
set root = CreateObject("FPC.Root")
set arrayx = root.GetContainingArray
set computersets = arrayx.RuleElements.ComputerSets
set bannedpcset = computersets.item("DeniedComputers")
set bannedpcsetcomputers = bannedpcset.computers
if isempty(request.querystring("room")) then
passedvar=split(request.querystring("pc"),"-")
tobemanaged=passedvar(0)
else
tobemanaged=request.querystring("room")
end if
'response.write(bannedpcsetcomputers.count)

if not isempty(request.querystring("submit")) then
if (request.querystring("submit") = "ban") then
for each itemx in request.querystring("pc")
ipaddress=lookupipaddress(itemx)
ipaddress = Replace(ipaddress, vbCr, " ")
trimmedip = rtrim(ltrim(ipaddress))
ref=bannedpcsetcomputers.add(itemx,trimmedip)

next
else
' remove from banned
for each itemx in request.querystring("pc")
ref=bannedpcsetcomputers.remove(itemx)
next

end if
arrayx.save
end if



dim fso, f,fc
folderspec="e:\logs\ips"
set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
set fc = f.files
banned = ""
Unbanned = ""
for each f1 in fc
pcname=split(f1.name,".")
if left(pcname(0), len(tobemanaged))= tobemanaged then

if bannedlookup(pcname(0)) then
banned = banned & "," & pcname(0)
else
unbanned = unbanned & "," & pcname(0)
end if
end if
next








function bannedlookup(lookupname)

for each itemz in bannedpcsetcomputers
if itemz.name = lookupname then
bannedlookup = true
exit function
end if

next
bannedlookup= false
end function

function lookupipaddress(pcnamez)

set gso = CreateObject("Scripting.FileSystemObject")
filepath="e:\logs\ips\" & pcnamez & ".txt"
set myfile = gso.opentextfile(filepath, forreading)
ipaddressline=myfile.readline

tempx=split(ipaddressline,":")
lookupipaddress=tempx(1)

end function

%>



<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<style type="text/css">
<!--
.style6 {
font-size: 36px;
font-family: Arial, Helvetica, sans-serif;
color: #003300;
font-weight: bold;
}
.style7 {font-family: Arial, Helvetica, sans-serif}
-->
</style>
<title>PC Internet control</title>
</head>
<body onLoad="if ('Navigator' == navigator.appName) document.forms[0].reset();">

<span class="style6">Fine Room Management for <% response.write (tobemanaged) %> </span>
<hr>


<table border="1" width="100%"><tr><td width="50%" valign="top">

Unbanned

<form action="rooms.asp" method="get">

<%
unbanned=split(unbanned,",")
for each item in unbanned
response.write "<input type='checkbox' name='pc' value='" & item & "'>" & item & "<br>"
next
%>
<p>
<input type="submit" name="submit" value="ban">
</p>
</form>

</td><td width="50%" valign="top">

Banned

<form action="rooms.asp" method="get">

<%
banned=split(banned,",")
for each item in banned
response.write "<input type='checkbox' name='pc' value='" & item & "'>" & item & "<br>"
next
%>
<p>
<input type="submit" name="submit" value="unban">
</p>
</form>





</td></tr></table>



[ June 21, 2005, 06:46 AM: Message edited by: browolf ]
Post #: 1

Page:   [1] << Older Topic    Newer Topic >>
All Forums >> [ISA Server 2004 Misc.] >> ISA Server 2004 Programming >> howto add pcs to computerset with ASP(vbscript) Page: [1]
Jump to:

New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts