Page 1 of 1 1
Topic Options
#197120 - 2009-12-15 12:02 PM KiX 4.51 + Windows 7 drive mapping + W2k3
harmen Offline
Just in Town

Registered: 2009-12-15
Posts: 4
Loc: Lichtenvoorde, Europe
Hello,

I am trying to create a logon script for a couple of computers in the AD.
There are a couple of computers within the AD that i want to run a logon script.

AD:

- Local domain security group with 2 computers in it.
- Logon script xendesklogon.bat set to user.

BAT xendesklogon.bat:

@ECHO_OFF
%0\..\KiX\Kix32.exe %0\..\KiX\xendesk.kix

KiXtart xendesk.kix:

If InGroup("OU\OU\Group")
Use G: "\\server\data"
EndIf

What am I doing wrong?

Thanks.


Edited by harmen (2009-12-15 12:10 PM)

Top
#197121 - 2009-12-15 12:12 PM Re: KiX 4.51 + Windows 7 drive mapping + W2k3 [Re: harmen]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Hi and welcome to the board.

You have an error in the InGroup function.

 Code:
If InGroup("Group")
   Use G: "\\server\data"
EndIf


or

 Code:
If InGroup("domain\Group")
   Use G: "\\server\data"
EndIf


Should both do the trick. You might need to include the domain name but that depends on your setup.


Edited by Mart (2009-12-15 12:13 PM)
Edit Reason: Added some stuff.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#197122 - 2009-12-15 12:25 PM Re: KiX 4.51 + Windows 7 drive mapping + W2k3 [Re: Mart]
harmen Offline
Just in Town

Registered: 2009-12-15
Posts: 4
Loc: Lichtenvoorde, Europe
Thanks for your quick reply.

Both

 Code:
If InGroup("domain\Group")
   Use G: "\\server\data"
EndIf


 Code:
If InGroup("domain.local\Group")
   Use G: "\\server\data"
EndIf


and

 Code:
If InGroup("Group")
   Use G: "\\server\data"
EndIf


Are not working...

When I delete the If/EndIf construction, it works. So you are right that there is an error in the InGroup.


Edited by harmen (2009-12-15 12:28 PM)

Top
#197124 - 2009-12-15 01:22 PM Re: KiX 4.51 + Windows 7 drive mapping + W2k3 [Re: harmen]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
InGroup is fine. You might have some issues with the cache that is kept for a all groups a user is a member of. I would also recommend an upgrade to 4.61. This version has proper Windows 7 support.

You can run your script with the /f parameter or delete the registry key below. Be aware that the registry key will be created with new info from AD when a user logs on so deleting it, logging off and on again would give you the most up to date info from AD in the registry key below.

 Quote:

HKEY_CURRENT_USER\Software\KiXtart\TokenCache


I always use a small piece of code that deletes the token cache every x days. Have a look at the script below. This script requires the TimeDiff UDF.

UDF Library » TimeDiff() - calculate time difference between 2 timestamps

 Code:
;Read the last flush date from the registry.
$lastFlush = ReadValue("HKCU\Software\Kixtart", "DateLastFlush")
;Calculate the difference in days between today and the DateLastFlush value from the registry.
$dayssincelastflush = TimeDiff($lastflush, 'Today', 'D')
If $dayssincelastflush > 7 Or $lastflush = ""
	;Delete token cache registry key if last flush is more then x days ago or last flush is empty (only on first run).
	$rc = DelKey("HKU\" + @SID + "\Software\KiXtart\TokenCache")
	;Write current date and time to the registry. The path will be created if it doesn’t exist.
	$rc = WriteValue("HKCU\Software\Kixtart", "DateLastFlush", @DATE, "REG_SZ")
	$rc = WriteValue("HKCU\Software\Kixtart", "TimeLastFlush", @TIME, "REG_SZ")
EndIf
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#197126 - 2009-12-15 01:36 PM Re: KiX 4.51 + Windows 7 drive mapping + W2k3 [Re: Mart]
harmen Offline
Just in Town

Registered: 2009-12-15
Posts: 4
Loc: Lichtenvoorde, Europe
I got it working now, thanks. I added computers only to the security group. Apparently the script only works when you add users to the group, not computers.

Is there a way to get the script work with computers in the group?
I want this script applying for users that login on these specific computers.

EDIT: also upgraded to 461.


Edited by harmen (2009-12-15 01:42 PM)

Top
#197128 - 2009-12-15 02:31 PM Re: KiX 4.51 + Windows 7 drive mapping + W2k3 [Re: harmen]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
The built-in InGroup() will not work with computer accounts.

There are a number of different solutions - search the board for alternatives.

One example is ComputerInGroup()

Top
#197129 - 2009-12-15 02:39 PM Re: KiX 4.51 + Windows 7 drive mapping + W2k3 [Re: Richard H.]
harmen Offline
Just in Town

Registered: 2009-12-15
Posts: 4
Loc: Lichtenvoorde, Europe
Works great! Thanks alot Richard/Allen/Mart.

Edited by harmen (2009-12-15 02:41 PM)

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 1808 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.128 seconds in which 0.101 seconds were spent on a total of 13 queries. Zlib compression enabled.

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