+ Post New Thread
Results 1 to 2 of 2
Scripts Thread, ISA2004:howto add/remove computers from a computerset in Coding and Web Development; the ip log files are created from a line in the login script that says: ipconfig | find "IP Address" ...
  1. #1
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,527
    Thank Post
    107
    Thanked 89 Times in 75 Posts
    Blog Entries
    46
    Rep Power
    40

    ISA2004:howto add/remove computers from a computerset

    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. Some knowledge of asp would be needed to alter this for other use.

    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 & "
    "
    next
    %>
      
    
    
        <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 & "
    "
    next
    %>
      
    
    
        <input type="submit" name="submit" value="unban">
    </p>
    </form>
    
    
    
    
    
    </td></tr></table>

  2. #2
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,527
    Thank Post
    107
    Thanked 89 Times in 75 Posts
    Blog Entries
    46
    Rep Power
    40
    Also valid in ISA2006

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 4
    Last Post: 6th March 2014, 02:00 PM
  2. Asterisk howto?
    By localzuk in forum General Chat
    Replies: 7
    Last Post: 20th September 2007, 07:13 PM
  3. Howto display an internet policy
    By MarkB in forum How do you do....it?
    Replies: 5
    Last Post: 12th January 2007, 10:31 PM
  4. snmp on isa2004
    By browolf in forum Windows
    Replies: 1
    Last Post: 11th May 2006, 09:26 AM
  5. Replies: 4
    Last Post: 7th October 2005, 10:55 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •