Page 1 of 1 1
Topic Options
#115532 - 2004-03-05 01:22 PM list computer groups
otf Offline
Getting the hang of it

Registered: 2003-11-21
Posts: 53
Loc: Scotland
i have used the ComputerInGroup UDF without problem
BUT you need to specify a $group to start with.
how can i simply retreive a list of all the groups a PC is a member of?

cheers

Top
#115533 - 2004-03-05 02:02 PM Re: list computer groups
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Code:
break On
$obj = GetObject("WinNT://domain/computername$$,user")
? @serror
for each $grp in $obj.groups
? $grp.name
next

exit 0

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#115534 - 2004-03-05 05:26 PM Re: list computer groups
otf Offline
Getting the hang of it

Registered: 2003-11-21
Posts: 53
Loc: Scotland
many thanks,
i used this with ReadProfileString to create an Internet Proxy Switch. Along with the front end ASP page, the kix checks for the PC group membership, if PC group is listed in INI file, apply settings
on=Internet access
off=Internet Denied
took me a while but it appears to be working now. thanks for the help.

here's my final code if your interested!

CLS
$NSini=("\\inipath\InternetAccess.ini")
$domain=("domain")
$PC=$grp.name
Break On
$obj = GetObject("WinNT://" + @domain + "/" + @wksta + "$$")
? @serror
For Each $grp in $obj.groups
? $grp.name
If ReadProfileString($NSini,"Rooms",$grp.name)
If ReadProfileString($NSini,"Rooms",$grp.name)="on"
;Enable Proxy
WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer","x.x.x.x:80","REG_SZ")
WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Start Page", "http://x.x.x.x/", "REG_SZ")
CLS
Else
;Disable Proxy
WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer","x.x.x.x:80","REG_SZ")
WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Start Page", "http://x.x.x.x/", "REG_SZ")
CLS
EndIf
EndIf
Next
Exit 0

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 640 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.052 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org