Jump to content

ISA2004:howto add/remove computers from a computerset


Recommended Posts

Posted

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=

 

where is a computer name prefix. Some knowledge of asp would be needed to alter this for other use.

 

<%
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		

%>







<br />
<!--<br />
.style6 {<br />
	font-size: 36px;<br />
	font-family: Arial, Helvetica, sans-serif;<br />
	color: #003300;<br />
	font-weight: bold;<br />
}<br />
.style7 {font-family: Arial, Helvetica, sans-serif}<br />
--><br />

PC Internet control



Fine Room Management for <% response.write (tobemanaged) %> 



</pre><table border="1" width="100%">

Unbanned



<%
unbanned=split(unbanned,",")
for each item in unbanned
response.write   "" & item & "
"
next
%>
 


   





Banned



<%
banned=split(banned,",")
for each item in banned
response.write   "" & item & "
"
next
%>
 


   







</

  • 5 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...