Welcome to ISAserver.org
Forums |
Register |
Login |
My Profile |
Inbox |
RSS
|
My Subscription |
My Forums |
Address Book |
Member List |
Search |
FAQ |
Ticket List |
Log Out
howto add/remove computer sets from a rule with ASP(vbscript) webpages
|
Users viewing this topic:
none
|
Logged in as: Guest
|
Login | |
|
howto add/remove computer sets from a rule with ASP(vbs... - 9.May2005 3:46:00 PM
|
|
|
browolf
Posts: 15
Joined: 11.Feb.2005
Status: offline
|
I've got the sdk with its horrible manual. I've managed to figure out adding, but removing is another matter. cant find any samples that deal with removing items not whole rules. It doesnt seem to be as simple as changing .add into .remove :-(
code:
'to add room T10 to rule
sub controlcomputers()
dim root set root = CreateObject("FPC.Root") dim array dim policyrules dim computersets dim pupilrule set array = root.GetContainingArray set policyrules = array.ArrayPolicy.PolicyRules set computrsets = array.RuleElements.ComputerSets set pupilrule = policyrules.item("Pupil Access") pupilrule.SourceSelectionIPs.computersets.add "T10", fpcinclude pupilrule.save CheckError wscript.echo "Done!" end sub
sub CheckError()
if Err.Number <> 0 then wscript.echo "An error occurred: 0x" & hex(err.number) & " " & err.Description err.clear end if end sub
controlcomputers
[ June 21, 2005, 07:31 AM: Message edited by: browolf ]
|
|
|
|
RE: howto add/remove computer sets from a rule with ASP... - 9.May2005 4:25:00 PM
|
|
|
browolf
Posts: 15
Joined: 11.Feb.2005
Status: offline
|
eventually, 45mins, i've worked out to replace .remove with .removespecified
code:
sub controlcomputers()
dim root set root = CreateObject("FPC.Root") dim array dim policyrules dim computersets dim pupilrule set array = root.GetContainingArray set policyrules = array.ArrayPolicy.PolicyRules set computrsets = array.RuleElements.ComputerSets set pupilrule = policyrules.item("Pupil Access") pupilrule.SourceSelectionIPs.computersets.removespecified "T10" pupilrule.save CheckError wscript.echo "Done!" end sub
sub CheckError()
if Err.Number <> 0 then wscript.echo "An error occurred: 0x" & hex(err.number) & " " & err.Description err.clear end if end sub
controlcomputers
[ May 09, 2005, 05:01 PM: Message edited by: browolf ]
|
|
|
|
RE: howto add/remove computer sets from a rule with ASP... - 9.May2005 5:00:00 PM
|
|
|
browolf
Posts: 15
Joined: 11.Feb.2005
Status: offline
|
i've got it to enumerate which computersets are added to the rule.
code:
sub controlcomputers()
dim root set root = CreateObject("FPC.Root") dim array dim policyrules dim computersets dim pupilrule set array = root.GetContainingArray set policyrules = array.ArrayPolicy.PolicyRules set pupilrule = policyrules.item("Pupil Access")
set computersets = pupilrule.SourceSelectionIPs.ComputerSets for each blag in computersets wscript.echo blag.Name next pupilrule.save CheckError wscript.echo "Done!" end sub
sub CheckError()
if Err.Number <> 0 then wscript.echo "An error occurred: 0x" & hex(err.number) & " " & err.Description err.clear end if end sub
controlcomputers
i found a typo, but luckily it was in a line not in use in the previous scripts.
|
|
|
|
RE: howto add/remove computer sets from a rule with ASP... - 10.May2005 9:47:00 AM
|
|
|
browolf
Posts: 15
Joined: 11.Feb.2005
Status: offline
|
to list the computersets attached to a rule:
code:
set computersets = pupilrule.SourceSelectionIPs.ComputerSets for each blag in computersets wscript.echo blag.Name next
to list all the computersets that exist
code:
set computersets = array.RuleElements.ComputerSets for each blag in computersets wscript.echo blag.Name next
|
|
|
|
RE: howto add/remove computer sets from a rule with ASP... - 15.Jun.2005 4:30:00 AM
|
|
|
browolf
Posts: 15
Joined: 11.Feb.2005
Status: offline
|
a combination of above that i'm going to run as a scheduled task to remove all the tcomputer sets from the rule at specified times.
code:
sub controlcomputers()
dim root set root = CreateObject("FPC.Root") dim array dim policyrules dim computersets dim pupilrule set array = root.GetContainingArray set policyrules = array.ArrayPolicy.PolicyRules set pupilrule = policyrules.item("Pupil Access")
set computersets = pupilrule.SourceSelectionIPs.ComputerSets for each blag in computersets wscript.echo blag.Name pupilrule.SourceSelectionIPs.computersets.removespecified blag.Name next pupilrule.save CheckError wscript.echo "Done!" end sub
sub CheckError()
if Err.Number <> 0 then wscript.echo "An error occurred: 0x" & hex(err.number) & " " & err.Description err.clear end if end sub
controlcomputers
|
|
|
|
RE: howto add/remove computer sets from a rule with ASP... - 15.Jun.2005 8:38:00 AM
|
|
|
browolf
Posts: 15
Joined: 11.Feb.2005
Status: offline
|
webpages to control what computer sets can access the internet. these pages only apply to a specific rule. in order for users to control access e.g. teachers in a school (my case) it appears you have to give them admin rights on the isa server.
index.asp enumerates the names of all the possible computer sets into a form. if len(blag.name) < 6 then excludes the builtin sets. anything you dont want appearing on the form you can just make the name longer than 6 chars. Any set currently set to 'on' has a ticked box.
code:
<% sub controlcomputers()
dim root set root = CreateObject("FPC.Root") dim array dim policyrules dim computersets dim pupilrule set array = root.GetContainingArray set policyrules = array.ArrayPolicy.PolicyRules set pupilrule = policyrules.item("Pupil Access") set computersets = array.RuleElements.ComputerSets dim onsets set onsets = pupilrule.SourceSelectionIPs.ComputerSets dim found,tmp for each blag in computersets if len(blag.name) < 6 then found = false 'tmp = if setlookup(blag.name,onsets) then Response.write "<input type='checkbox' name='room' value='" & blag.Name & "' checked>" & blag.name & "<br>" else Response.write "<input type='checkbox' name='room' value='" & blag.Name & "'>" & blag.name & "<br>" end if end if next pupilrule.save CheckError 'wscript.echo "Done!" end sub
sub CheckError()
if Err.Number <> 0 then Response.write "An error occurred: 0x" & hex(err.number) & " " & err.Description err.clear end if end sub
function setlookup(lookupname,lookinto) 'response.write "function start" & lookupname & "<p>" for each item in lookinto if item.name=lookupname then 'response.write item.name & " true " setlookup = true exit function end if 'response.write item.name & " false " next setlookup = false end function
%>
<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> <p class="style6">Internet Room Management </p> <hr noshade> <span class="style7">Ticked = Internet allowed in that room </span> <form action="process.asp" method="get"> <p> <!-- <input type="checkbox" name="checkbox" value="check"> --> <% controlcomputers %> </p> <p> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form>
process.asp
removes everything and then adds the ticked boxes passed from the previous page. re-asks what is 'on' and lists the results. if you have a set that contains pcs that are always 'on' its easier to put it on a separate rule.
code:
<% sub processform()
dim root set root = CreateObject("FPC.Root") dim array dim policyrules dim computersets dim pupilrule set array = root.GetContainingArray set policyrules = array.ArrayPolicy.PolicyRules set pupilrule = policyrules.item("Pupil Access")
set computersets = pupilrule.SourceSelectionIPs.ComputerSets for each blag in computersets 'response.write blag.Name pupilrule.SourceSelectionIPs.computersets.removespecified blag.Name next
for each itemx in request.querystring("room") pupilrule.SourceSelectionIPs.computersets.add itemx, fpcinclude 'response.write itemx next
pupilrule.save CheckError response.write "Validating...access allowed at: " for each blagx in computersets response.write blagx.Name & " " next
end sub sub CheckError()
if Err.Number <> 0 then Response.write "An error occurred: 0x" & hex(err.number) & " " & err.Description err.clear end if end sub
%>
<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> <p class="style6">Internet Room Management Processed</p> <hr noshade> <span class="style7">Ticked = Internet allowed in that room<p> </span>
<% processform %>
|
|
|
|
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 |
|