BrianMarsh
(Just in Town)
2008-09-12 03:51 PM
Changing desktops based on workstation names and group membership

Hi,

I am struggling a little, have inherited a server which is using Kix that I am not familiar with. We have a new bunch of computers in our school ICT Suite that ideally will display a different desktop depending on the group membership of the pupil logging in (eg Year1, Year 2 etc). This implimentation cannot affect the existing classroom PC's so I am assuming that I need to get the script to run based on the mahine name first and then group membership second.

The new PC's are named ICT-SUITE01 through to ICT-SUITE36


I don't seem to be able to find a way of easily adding a wildcard to the @WRKSTA and the script, when it does run, does not implement on the first login attempt by a user, but does work on subsequent login attempts.

So far, what I have working is


IF @WKSTA=("ICT-SUITE01")
writevalue ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Desktop","\\Server1\desktops\ICT Generic","REG_EXPAND_SZ")
Endif


This, of course, only works on one machine and I find it hard to believe that the correct way to implement a simple generic desktop for all users needs to be repeated for all the PC's!

I have had a bash at trying to create an array of the machines, but that does not work and the lack of error messages or similar does not help.

I haven't even started on the group bit yet...

As you can tell, I am a little flumaxed and hope that someone doesn't mind giving me a pointer in the right direction.

thanks

Brian


Mart
(KiX Supporter)
2008-09-12 04:05 PM
Re: Changing desktops based on workstation names and group membership

You could use a part of the system name if all effected systems have a part of the name in common like ICT or Room1 or something like it.

This example might help you with that.
 Code:

;Read a part of the system name start at the first character and read three characters.
If SubStr(@WKSTA, 1, 3) = "ICT"
	;do your magic
Else
	;do other magic or do nothing.
EndIf


You can also add all affected systems to an array, check the array and do your magic on the outcome.
 Code:
$computers = "System1","System","System3"

If AScan($computers, @WKSTA)
	;Do your magic here.
Else
	;Do other magic or do nothing.
EndIf


BrianMarsh
(Just in Town)
2008-09-12 08:48 PM
Re: Changing desktops based on workstation names and group membership

Cheers,

that's great and works a treat.