Page 1 of 1 1
Topic Options
#205218 - 2012-05-09 01:21 PM Help again with If ingroup Windows 2008 R2
xempa Offline
Fresh Scripter

Registered: 2006-08-12
Posts: 37
Hi

As a followup from a recent post "if ingroup Windows 2008 R2" I'm wondering if I jumped the gun a little that although printing is now working via if ingroup , I'm now having problems with simple drive mappings....

After trying various methods I'm hoping someone can point out what I am doing wrong or if there is a fix ?

Both Students and Staff groups are global AD groups and no I have no GPO and no UAC running
Also I am using kix 4.62 on a Windows 2003 server with an XP machine client for testing, I'm yet to try Win 7 . As I also had the same issue running this over a Windows 2008 Domain earlier today

Any help would be appreciated , thanks

 Code:
IF INGROUP(@domain+"\Students")
Use h: @LServer +"\Students$\"+@userID
Endif

IF INGROUP(@domain+"\Staff")
Use h: @LServer +"\Staff$\"+@userID
Endif 
========================================

IF INGROUP("Students")
Use h: "\\DC01\Students$\%username%"
Endif

IF INGROUP("Staff")
Use h: "\\DC01\Staff$\%username%"
Endif 
========================================


Trying to achieve the following 

IF INGROUP(@domain+"\Students")
? "member of students...."
Use h: '\\DC01\Students$\' + @userID
If Not Exist("\\DC01\Students$\%username%")
? "Making home directory for Student...."
    MD "\\DC01\Students$\%username%"
Endif
Endif


IF INGROUP(@domain+"\Staff")
? "member of Staff...."
Use h: '\\DC01\Staff$\' + @userID
If Not Exist("\\DC01\Staff$\%username%")
? "Making home directory for Staff...."
   MD "\\DC01\Staff$\%username%"
Endif
Endif 


Edited by Mart (2012-05-09 02:27 PM)
Edit Reason: Please use code tags when posting code.

Top
#205219 - 2012-05-09 02:36 PM Re: Help again with If ingroup Windows 2008 R2 [Re: xempa]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
A. Why aren't you using AD to create the home directories? When you specify the home dir \\server\Users\%USERNAME% as the home path when you create the user, it will be created with the correct permissions AND mapped automatically without any scripting.

B. If you have more than one DC and the home folders aren't replicated between them, mapping to @LSERVER\Students$\%USERNAME% may have a 50-50 chance of working, less if you have more than two DCs.

C. InGroup() assumes the current domain - no need to specify it.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#205221 - 2012-05-09 03:41 PM Re: Help again with If ingroup Windows 2008 R2 [Re: Glenn Barnas]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
my idea is, use @error and @serror to locate the problem.
without access to your environment we can only guess what is going on.
_________________________
!

download KiXnet

Top
#205223 - 2012-05-09 04:27 PM Re: Help again with If ingroup Windows 2008 R2 [Re: Lonkero]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Maybe the MD command should be BEFORE the use command?
Top
#205228 - 2012-05-09 05:05 PM Re: Help again with If ingroup Windows 2008 R2 [Re: ShaneEP]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
I'd be SHOCKED and APPALLED if the user had the permission to create their own folder on the Users share - ESPECIALLY in a school environment. That's a potential violation of security where PII could be stored.

The Kix issue is secondary to the process being followed for user management.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#205230 - 2012-05-09 11:43 PM Re: Help again with If ingroup Windows 2008 R2 [Re: Glenn Barnas]
xempa Offline
Fresh Scripter

Registered: 2006-08-12
Posts: 37
Hi many thanks for your responses and yes using AD to create the home share is certainly one way around it. But that aside without even getting into the ethics of home drive creation , my previous "sample" post was probrably a bad example to use. The basic problem of mapping shares can't be differentiated with if ingroup ?

Mapping home drives and shares isn't rocket science and fairly standard stuff in most environments , but even the following sample won't work ...Yes I also ran /d to troubleshoot the script plus /f to flush the cache with no errors. Also checked event logs still no errors

GPO and UAC turned off, only one domain controller ...weird ?

Again any help here would be appreciated.

 Code:
IF INGROUP("Students")
Use h: "\\DC01\ACC"
Endif

IF INGROUP("Staff")
Use h: "\\DC01\MNC"
Endif


Edited by Mart (2012-05-10 09:24 AM)
Edit Reason: Please use code tags when posting code.

Top
#205231 - 2012-05-10 12:23 AM Re: Help again with If ingroup Windows 2008 R2 [Re: xempa]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Try
 Code:
IF INGROUP("Students")
  ? "Mapping Students to H: - "
  Use h: "\\DC01\ACC"
  @serror
Endif


Does the message appear and display the error code?

Top
#205233 - 2012-05-10 01:04 AM Re: Help again with If ingroup Windows 2008 R2 [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and if you are trying it in logonscript, add get $:
 Code:
IF INGROUP("Students")
  ? "Mapping Students to H: - "
  Use h: "\\DC01\ACC"
  @serror
  if @error
   "press any key to continue"
   get $
  endif
Endif


and no, kixtart doesn't write errors to eventlog unless it itself has an internal issue OR you tell it to write there.
_________________________
!

download KiXnet

Top
#205234 - 2012-05-10 01:18 AM Re: Help again with If ingroup Windows 2008 R2 [Re: Allen]
xempa Offline
Fresh Scripter

Registered: 2006-08-12
Posts: 37
Hi thanks for that , unfortunatley still no difference without any errors. It's like it can't read any groups from AD. I also tried running @enumgroup which gives only 0 when run. Does this mean it can't see any groups ..I wonder ? Strangely enough it can map printers by if ingroup ?

Thanks

Top
#205235 - 2012-05-10 01:40 AM Re: Help again with If ingroup Windows 2008 R2 [Re: xempa]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
@enumgroup?

do you mean Enumgroup()?

there is a simple example in the documentation:
http://www.kixtart.org/?p=commandRef#_Toc146265742
_________________________
!

download KiXnet

Top
#205236 - 2012-05-10 01:51 AM Re: Help again with If ingroup Windows 2008 R2 [Re: xempa]
xempa Offline
Fresh Scripter

Registered: 2006-08-12
Posts: 37
Hi again it's like it can only see domain users and nothing else ?
Cheers

Top
#205237 - 2012-05-10 03:30 AM Re: Help again with If ingroup Windows 2008 R2 [Re: xempa]
xempa Offline
Fresh Scripter

Registered: 2006-08-12
Posts: 37
Great I found it !!!!

I was using universal and global groups. Once I swapped it to local domain it ran like a charm. Thanks to you who have been helping me

Cheers

Top
#205238 - 2012-05-10 03:40 AM Re: Help again with If ingroup Windows 2008 R2 [Re: xempa]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
uhm. universal and global groups weren't seen by kixtart?
_________________________
!

download KiXnet

Top
#205239 - 2012-05-10 10:32 AM Re: Help again with If ingroup Windows 2008 R2 [Re: Lonkero]
xempa Offline
Fresh Scripter

Registered: 2006-08-12
Posts: 37
Correct , kixtart couldn't be seen by either global or universal which sounds rearly odd it does however work with local domain..it doesn't make sense to me either ?

Any idea what could cause this as a side note ?

Cheers

Top
#205240 - 2012-05-10 01:48 PM Re: Help again with If ingroup Windows 2008 R2 [Re: xempa]
xempa Offline
Fresh Scripter

Registered: 2006-08-12
Posts: 37
Truly the oddest thing, now global groups are now working ????
Top
#205241 - 2012-05-10 02:12 PM Re: Help again with If ingroup Windows 2008 R2 [Re: xempa]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Remember to delete the cache when changing groups.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

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 793 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.072 seconds in which 0.028 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