Page 1 of 1 1
Topic Options
#199912 - 2010-09-16 09:31 AM Logon Skript not work correctly
Hal Offline
Fresh Scripter

Registered: 2010-09-16
Posts: 7
Loc: Germany
Hi,

i have a write a little logon script but it wont work very well
this mean somtime it work sometime not.
on target machines when i look in the eventviewer i see
ERROR 2221 usergetinfo
ERROR 2221 GetPrimaryGroup
ERROR 2221 UserlocalGroups
ERROR 1332 GetlookupSID failed

i search in the forum but not found what help

here is my skript
hope someone can help
we have two windows 2003 dc
kixtart version is 4.61

many thanks
Hal
 Code:
;-----------------------------------------------------------
; Drucker

If InGroup("mydomain\G-Technik")
If AddPrinterConnection("\\printserver\Technik_Kyocera") <> 0
endif
EndIf



If InGroup("mydomain\G-GL")
If AddPrinterConnection("\\printserver\GF_Canon") <> 0
EndIf
EndIf

If InGroup("mydomain\G-Verwaltung") or @WkSta = "DRUCKER_TEST"
If AddPrinterConnection("\\printserver\Orga_Brother") <> 0
EndIf
If AddPrinterConnection("\\printserver\Orga_Canon") <> 0
EndIf
EndIf

If InGroup("mydomain\G-Vertrieb") or @WkSta = "DRUCKER_TEST"
If AddPrinterConnection("\\printserver\Vertrieb_Canon") <> 0
EndIf
EndIf
;-----------------------------------------------------------
; Standard-Verzeichnise

Use B: "\\mydomain\dfs\büroorga"
Use U: "\\mydomain\dfs\user\" + @USERID
Use M: "\\mydomain\dfs\büro"

;-----------------------------------------------------------
; Mitarbeiter-Gruppe

If InGroup("mydomain\G-Mitarbeiter")
	Use P: "\\mydomain\dfs\projekte"
EndIf


;-----------------------------------------------------------
; Auszubildende-Gruppe

If InGroup("mydomain\G-Auszubildende")
	Use P: "\\mydomain\dfs\projekte"
EndIf


;-----------------------------------------------------------
; Praktikanten-Gruppe

If InGroup("mydomain\G-Praktikanten")
	Use K: "\\mydomain\dfs\Praktikanten"
EndIf


;-----------------------------------------------------------
; Vertrieb-Gruppe

If InGroup("mydomain\G-Vertrieb")
	Use W: "\\mydomain\dfs\vertrieb"
EndIf


;-----------------------------------------------------------
; Verwaltung-Verzeichnis

If InGroup("mydomain\G-Verwaltung")
	Use V: "\\mydomain\verwaltung\verwaltung"
	Use N: "\\mydomain\dfs\marketing"
EndIf


;-----------------------------------------------------------
; VerwaltungVertrieb-Verzeichnis

If InGroup("mydomain\G-Verwaltung") Or InGroup("mydomain\G-Vertrieb")
	Use L: "\\mydomain\dfs\verwaltungvertrieb"
EndIf


;-----------------------------------------------------------
; Technik-Gruppe

If InGroup("mydomain\G-Technik")
;	Use I: "\\mydomain\dfs\install"
	Use T: "\\mydomain\dfs\technik"
EndIf
;-----------------------------------------------------------
; GL-Verzeichnis

If InGroup("mydomain\G-GL")
	Use G: "\\mydomain\verwaltung\gl"
	Use N: "\\mydomain\dfs\marketing"
EndIf

;-----------------------------------------------------------
; Fibu-Verzeichnis

If InGroup("mydomain\G-Fibu")
	Use S: "\\mydomain\verwaltung\fibu"
Endif


Edited by Mart (2010-09-16 10:57 AM)
Edit Reason: Please use code tags when posting code.

Top
#199953 - 2010-09-17 08:59 PM Re: Logon Skript not work correctly [Re: Hal]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you say you can see these events in the eventlogs but what is the source?
do they appear how often?
_________________________
!

download KiXnet

Top
#199966 - 2010-09-20 02:12 PM Re: Logon Skript not work correctly [Re: Lonkero]
Hal Offline
Fresh Scripter

Registered: 2010-09-16
Posts: 7
Loc: Germany
the source is KIXTART.

they appear 14 times during logon,
but the script did not start.
on some pc the script starts and quit before the If InGroup check.

when i run the skript manualy everythink is all right.

What and why can this be???

Top
#199970 - 2010-09-20 04:17 PM Re: Logon Skript not work correctly [Re: Hal]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Ok. I cleaned up the code a bit and stuffed loads of error checking in it.
What happens if you run it like this?

 Code:
; Drucker
If InGroup("mydomain\G-Technik")
	? "Deleting \\printserver\Technik_Kyocera"
	$rc = DelPrinterConnection("\\printserver\Technik_Kyocera")
	? @ERROR
	? @SERROR
	?"Mapping \\printserver\Technik_Kyocera"
	$rc = AddPrinterConnection("\\printserver\Technik_Kyocera")
	? @ERROR
	? @SERROR
EndIf

If InGroup("mydomain\G-GL")
	? "Deleting \\printserver\GF_Canon"
	$rc = DelPrinterConnection("\\printserver\GF_Canon")
	? @ERROR
	? @SERROR
	?"Mapping \\printserver\GF_Canon"
	$rc = AddPrinterConnection("\\printserver\GF_Canon")
	? @ERROR
	? @SERROR
EndIf

If InGroup("mydomain\G-Verwaltung") Or @WkSta = "DRUCKER_TEST"
	? "Deleting \\printserver\Orga_Brother"
	$rc = DelPrinterConnection("\\printserver\Orga_Brother")
	? @ERROR
	? @SERROR
	?"Mapping \\printserver\Orga_Brother"
	$rc = AddPrinterConnection("\\printserver\Orga_Brother")
	? @ERROR
	? @SERROR
	?"Mapping \\printserver\Orga_Canon"
	$rc = AddPrinterConnection("\\printserver\Orga_Canon")
	? @ERROR
	? @SERROR
EndIf

If InGroup("mydomain\G-Vertrieb") Or @WkSta = "DRUCKER_TEST"
	? "Deleting \\printserver\Vertrieb_Canon"
	$rc = DelPrinterConnection("\\printserver\Vertrieb_Canon")
	? @ERROR
	? @SERROR
	?"Mapping \\printserver\Vertrieb_Canon"
	$rc = AddPrinterConnection("\\printserver\Vertrieb_Canon")
	? @ERROR
	? @SERROR
EndIf

; Standard-Verzeichnise
Use B: /delete /persistent
? "Deleting B drive"
? @ERROR
? @SERROR
Use B: "\\mydomain\dfs\büroorga"
?"Mapping B drive."
? @ERROR
? @SERROR

Use U: /delete /persistent
? "Deleting U drive"
? @ERROR
? @SERROR
Use U: "\\mydomain\dfs\user\" + @USERID
?"Mapping U drive."
? @ERROR
? @SERROR

Use M: /delete /persistent
? "Deleting M drive"
? @ERROR
? @SERROR
Use M: "\\mydomain\dfs\büro"
?"Mapping M drive."
? @ERROR
? @SERROR

; Mitarbeiter-Gruppe
If InGroup("mydomain\G-Mitarbeiter")
	Use P: /delete /persistent
	? "Deleting P drive"
	? @ERROR
	? @SERROR
	Use P: "\\mydomain\dfs\projekte"
	?"Mapping P drive."
	? @ERROR
	? @SERROR
EndIf

; Auszubildende-Gruppe
If InGroup("mydomain\G-Auszubildende")
	Use P: /delete /persistent
	? "Deleting P drive"
	? @ERROR
	? @SERROR
	Use P: "\\mydomain\dfs\projekte"
	?"Mapping P drive."
	? @ERROR
	? @SERROR
EndIf

; Praktikanten-Gruppe
If InGroup("mydomain\G-Praktikanten")
	Use K: /delete /persistent
	? "Deleting K drive"
	? @ERROR
	? @SERROR
	Use K: "\\mydomain\dfs\Praktikanten"
	?"Mapping K drive."
	? @ERROR
	? @SERROR
EndIf

; Vertrieb-Gruppe
If InGroup("mydomain\G-Vertrieb")
	Use K: /delete /persistent
	? "Deleting K drive"
	? @ERROR
	? @SERROR
	Use W: "\\mydomain\dfs\vertrieb"
	?"Mapping W drive."
	? @ERROR
	? @SERROR
EndIf

; Verwaltung-Verzeichnis
If InGroup("mydomain\G-Verwaltung")
	Use V: /delete /persistent
	? "Deleting V drive"
	? @ERROR
	? @SERROR
	Use V: "\\mydomain\verwaltung\verwaltung"
	?"Mapping V drive."
	? @ERROR
	? @SERROR
	Use N: /delete /persistent
	? "Deleting N drive"
	? @ERROR
	? @SERROR
	Use N: "\\mydomain\dfs\marketing"
	?"Mapping N drive."
	? @ERROR
	? @SERROR
EndIf

; VerwaltungVertrieb-Verzeichnis
If InGroup("mydomain\G-Verwaltung") Or InGroup("mydomain\G-Vertrieb")
	Use L: /delete /persistent
	? "Deleting L drive"
	? @ERROR
	? @SERROR
	Use L: "\\mydomain\dfs\verwaltungvertrieb"
	?"Mapping L drive."
	? @ERROR
	? @SERROR
EndIf

; Technik-Gruppe
If InGroup("mydomain\G-Technik")
	;Use I: /delete /persistent
	;Use I: "\\mydomain\dfs\install"
	Use T: /delete /persistent
	? "Deleting T drive"
	? @ERROR
	? @SERROR
	Use T: "\\mydomain\dfs\technik"
	?"Mapping T drive."
	? @ERROR
	? @SERROR
EndIf

; GL-Verzeichnis
If InGroup("mydomain\G-GL")
	Use G: /delete /persistent
	? "Deleting G drive"
	? @ERROR
	? @SERROR
	Use G: "\\mydomain\verwaltung\gl"
	?"Mapping G drive."
	? @ERROR
	? @SERROR
	Use N: /delete /persistent
	? "Deleting N drive"
	? @ERROR
	? @SERROR
	Use N: "\\mydomain\dfs\marketing"
	?"Mapping N drive."
	? @ERROR
	? @SERROR
EndIf

; Fibu-Verzeichnis
If InGroup("mydomain\G-Fibu")
	Use S: /delete /persistent
	? "Deleting S drive"
	? @ERROR
	? @SERROR
	Use S: "\\mydomain\verwaltung\fibu"
	?"Mapping S drive."
	? @ERROR
	? @SERROR
EndIf
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#199981 - 2010-09-21 10:48 AM Re: Logon Skript not work correctly [Re: Mart]
Hal Offline
Fresh Scripter

Registered: 2010-09-16
Posts: 7
Loc: Germany
Hello,

Thank you Mart!
i try it but still get 13 errors
11x Error 2221 UserGetInfo
Error 1332 GetPG
Error 1332 GetPrimaryGroup

the mapping of the drive seems to be working.
but i don´t get any printer even when i disable the in ingroup funktion for the printer.

when i run it manualy it works without any failure in the eventlog.
Really Strange for me.

Regards,
Hal

Top
#199982 - 2010-09-21 11:03 AM Re: Logon Skript not work correctly [Re: Hal]
Hal Offline
Fresh Scripter

Registered: 2010-09-16
Posts: 7
Loc: Germany
one question
what mean $rc or what it does??

Top
#199983 - 2010-09-21 11:12 AM Re: Logon Skript not work correctly [Re: Hal]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Error 1332 means ERROR_NONE_MAPPED 1332 (0x534) No mapping between account names and security IDs was done.

Sounds familiar we someone that had the same issues some time ago. There was also a fix for this if I recall correctly. I did not find the post. I’ll do some searching and If I find I’ll let you know.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#199984 - 2010-09-21 12:24 PM Re: Logon Skript not work correctly [Re: Mart]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
I think this might be the post Mart was thinking of:

1332 error

Top
#199985 - 2010-09-21 12:49 PM Re: Logon Skript not work correctly [Re: Hal]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
 Originally Posted By: Hal
one question
what mean $rc or what it does??
$Rc catches the "Return Code".

Most functions return values. Some function return codes mimic or mirror the error status, making them somewhat redundant if things go well. Thus, if you call a function and then test the @ERROR code, you can usually ignore the return code. If you don't "catch" it by putting it into a variable, it just "falls out" of your code and you wind up with random text (mostly numbers) on your screen.

This is described in more detail in the FAQ section.

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

Top
#199986 - 2010-09-21 01:16 PM Re: Logon Skript not work correctly [Re: BradV]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
 Originally Posted By: BradV
I think this might be the post Mart was thinking of:

1332 error


Yes. That’s it.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#199990 - 2010-09-21 03:33 PM Re: Logon Skript not work correctly [Re: Mart]
Hal Offline
Fresh Scripter

Registered: 2010-09-16
Posts: 7
Loc: Germany
thanks
but why it is working manualy???
and not at the logon???

Top
#199992 - 2010-09-21 04:25 PM Re: Logon Skript not work correctly [Re: Hal]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Could be a timing issue. I do not know your setup or network history so it is a bit difficult to see why this is happening.
Did you check out the link Brad posted and the link in that thread?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#199994 - 2010-09-21 04:44 PM Re: Logon Skript not work correctly [Re: Mart]
Hal Offline
Fresh Scripter

Registered: 2010-09-16
Posts: 7
Loc: Germany
yes i check the link but i cant find the sid history on my ad
Top
#199995 - 2010-09-21 05:31 PM Re: Logon Skript not work correctly [Re: Hal]
Hal Offline
Fresh Scripter

Registered: 2010-09-16
Posts: 7
Loc: Germany
i have looked now with different tools
ldp.exe, whoiam, José,..
but i cant find the SID history

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
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.066 seconds in which 0.026 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