Page 2 of 2 <12
Topic Options
#183393 - 2007-12-07 03:26 PM Re: share mapping with script - strange results [Re: Howard Bullock]
mikeemikee Offline
Fresh Scripter

Registered: 2007-06-12
Posts: 23
Loc: Germany, Hildesheim
 Originally Posted By: Howard Bullock
Logically your FOR loop is the problem

 Code:
	For Each $sShare in Split(ReadProfileString($sShareIni,"LOCATION "+$sGroup,""),Chr(10)) 


It seems to be looping two times when you expect on one iteration.

Can you post more of your INI file for testing?





Yes, no problem, here is more of the ini-file:

[LOCATION AeD_map]
ad=W:| "\\hildesheim\dfs01\AerztlicherDienst"
ad=U:| "\\hildesheim\dfs01\AerztlicherDienst\SD\Psychiatrie"


[LOCATION BA_map]
ba=H:| "\\hildesheim\dfs01\Daten\Betriebsarzt"


[LOCATION Bank_map]
bank=I:| "\\hildesheim\dfs01\Bank"

[LOCATION BH_map]
kidicap=I:| "\\hildesheim\dfs01\KIDICAP"
pdl-rw=P:| "\\hildesheim\dfs01\PDL-RW"


[LOCATION Brunie_map]
brunie=V:| "\\hildesheim\dfs01\brunie"

[LOCATION Brunieformular_map]
brunieformular=Y:| "\\hildesheim\dfs01\Brunieformulare"


[LOCATION Datenschutz_map]
datenschutz=Q:| "\\hildesheim\dfs01\Datenschutz"


[LOCATION DPALLTEST_map]
dp-alltest=W:| "\\hildesheim\dfs01\DP-ALLTEST"


[LOCATION Druckerei_map]
druckerei=K:| "\\hildesheim\dfs01\Druckerei"
ergo_mrv=H:| "\\hildesheim\dfs01\ERGO_MRV"

Top
#183394 - 2007-12-07 03:34 PM Re: share mapping with script - strange results [Re: mikeemikee]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
should these two be combined into one?

[LOCATION BA_map]
ba=H:| "\\hildesheim\dfs01\Daten\Betriebsarzt"

[LOCATION BH_map]
kidicap=I:| "\\hildesheim\dfs01\KIDICAP"
pdl-rw=P:| "\\hildesheim\dfs01\PDL-RW"
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#183395 - 2007-12-07 03:42 PM Re: share mapping with script - strange results [Re: Benny69]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I did not read all of the posts
Just a quick question
 Code:
C:\>\\hildesheim\netlogon\kix32 \\hildesheim\netlogon\test.kix /f

Do you want to clear the tokencache?
If yes, I think you should write
 Code:
C:\>\\hildesheim\netlogon\kix32 /f \\hildesheim\netlogon\test.kix

Top
#183396 - 2007-12-07 03:47 PM Re: share mapping with script - strange results [Re: Benny69]
mikeemikee Offline
Fresh Scripter

Registered: 2007-06-12
Posts: 23
Loc: Germany, Hildesheim
 Originally Posted By: Benny69
should these two be combined into one?

[LOCATION BA_map]
ba=H:| "\\hildesheim\dfs01\Daten\Betriebsarzt"

[LOCATION BH_map]
kidicap=I:| "\\hildesheim\dfs01\KIDICAP"
pdl-rw=P:| "\\hildesheim\dfs01\PDL-RW"



No, these are two sections, why?

Top
#183397 - 2007-12-07 03:48 PM Re: share mapping with script - strange results [Re: Witto]
mikeemikee Offline
Fresh Scripter

Registered: 2007-06-12
Posts: 23
Loc: Germany, Hildesheim
 Originally Posted By: Witto
I did not read all of the posts
Just a quick question
 Code:
C:\>\\hildesheim\netlogon\kix32 \\hildesheim\netlogon\test.kix /f

Do you want to clear the tokencache?
If yes, I think you should write
 Code:
C:\>\\hildesheim\netlogon\kix32 /f \\hildesheim\netlogon\test.kix


Isn`t it the same?

Top
#183398 - 2007-12-07 03:49 PM Re: share mapping with script - strange results [Re: mikeemikee]
mikeemikee Offline
Fresh Scripter

Registered: 2007-06-12
Posts: 23
Loc: Germany, Hildesheim
will be back on monday, have all a nice weekend.
Top
#183400 - 2007-12-07 03:58 PM Re: share mapping with script - strange results [Re: mikeemikee]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
 Originally Posted By: mikeemikee
Isn`t it the same?
No

Top
#183401 - 2007-12-07 04:00 PM Re: share mapping with script - strange results [Re: mikeemikee]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
doh! didn't notice BA BH not the same
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#183404 - 2007-12-07 04:37 PM Re: share mapping with script - strange results [Re: Benny69]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Sorry, I have to review my answer
Yes, it is the same.
 Code:
C:\Script\KiX2010_453\KiX2010.453>kix32
KiXtart 2010 4.53 / Copyright Ruud van Velsen 2006
Microsoft Windows (logon) script processor.

Note: KiXtart is CareWare, please consult the manual for full details
on distribution and licensing.

Usage :

[/t]  [script1] [...] [$var=123] [/f[:yyyy/mm/dd]] [/r:irel] [/u:password] [/d]

Options:
/d = enable debug mode
/f = flush token cache (optionally only if older than date specified)
/r = KXRPC search order (see manual for details)
/u = password to lock or unlock a pre-tokenized script
/t = tokenize scripts (see manual for details)

/f can be written anywhere in the command line

Top
#183456 - 2007-12-10 11:44 AM Re: share mapping with script - strange results [Re: Witto]
mikeemikee Offline
Fresh Scripter

Registered: 2007-06-12
Posts: 23
Loc: Germany, Hildesheim
Hello,

back again, wish you a new good start in the week!

stefan

Top
#183457 - 2007-12-10 12:34 PM Re: share mapping with script - strange results [Re: Benny69]
mikeemikee Offline
Fresh Scripter

Registered: 2007-06-12
Posts: 23
Loc: Germany, Hildesheim
 Originally Posted By: Benny69
Hi mikeemikee,

lets try a little different approch, run this:
 Code:
$objRootDSE = GetObject("LDAP://rootDSE")
$defaultNamingContext = $objRootDSE.Get("defaultNamingContext")

$sShareIni= @SCRIPTDIR + "\netmap_DH.ini"

If ReadProfileString($sShareIni,"","")
	If $bDEBUG
		"DEBUG: Die folgenden Sektionen erscheinen in der INI.-Datei:" ?
		"-----------------------------------------------------" ?
		ReadProfileString($sShareIni,"","")
		"-----------------------------------------------------" ?
	EndIf
Else
	If Exist($sShareIni)
		"ERROR: INI-Datei '"+$sShareIni+"' ist leer oder ungültig!" ?
	Else
		"ERROR: INI-Datei '"+$sShareIni+"' existiert nicht!" ?
	EndIf
	Exit 1
EndIf

Use LIST @CRLF
Use * /DELETE @CRLF

$bDEBUG=1
$username=@WUSERID

$MemberOfArray = Split(MemberOfArray(),',')

;While $sGroup AND Not @FEHLER
;Do
For Each $sGroup in $MemberOfArray

	If InStr($sGroup,"\") $sGroup=SubStr($sGroup,InStr($sGroup,"\")+1)
	EndIf

	If $bDEBUG Color w+/b "DEBUG: Suche nach Sektion [LOCATION "+$sGroup+"]" Color w/n ? 
	EndIf

	For Each $sShare in Split(ReadProfileString($sShareIni,"LOCATION "+$sGroup,""),Chr(10))

		If $sShare

			$asSharePair=Split(ReadProfileString($sShareIni,"LOCATION "+$sGroup,$sShare),"|")			
			Dim $Befehl1
			$Befehl1 = $asSharePair[0]+$asSharePair[1]
			"Mappe Netzwerkpfad "+$asSharePair[1]+" auf "+$asSharePair[0] @CRLF
			
			Execute( 'USE $Befehl1' )
			If @ERROR=0
				? "1. Statement" @CRLF
				"  " Color g+/n "OK" Color w/n @CRLF				
				? "Fehlercode " + "im " + $sShare + " : " +@Error @CRLF
			Else
				? "Else-Statement" @CRLF
			
				"  " Color r+/n "*Fehlgeschlagen*" Color w/n @CRLF
				? "Fehlercode " + "im " + $sShare + " : " +@Error @CRLF
			EndIf
		EndIf
	Next

;	$iIndex = $iIndex + 1
;	$sGroup = EnumGroup($iIndex)

;Loop
;Until Len($sGroup) = 0
Next

Use B: "\\fs01\home$\$username"
	If @ERROR=0
		? "B ist angehaengt" +@Error
		? "Fehlercode: " +@Error
	Else
		? "Fehler" +@Error
		? "Fehlercode: " +@Error
	EndIf

Use LIST @CRLF

Exit 0

Function MemberOfArray()
	$E_ADS_PROPERTY_NOT_FOUND = &8000500D
  $ObjUser = GetObject ("LDAP://" + GetUserDistinguishedName(@FULLNAME))
  $IntPrimaryGroupID = $ObjUser.Get("PrimaryGroupID")
	$ArrMemberOf = $ObjUser.GetEX("MemberOf")
	If $ERR.Number = $E_ADS_PROPERTY_NOT_FOUND
		$= MessageBox("The MemberOf Attribute Is Not Set.","Error!",16)
		Exit
	Else
		For Each $Group in $ArrMemberOf
			$x = InStr($Group,",")
			$GroupName = SubStr($Group,4,$x - 4)
			$MemberOfArray = $MemberOfArray+','+$GroupName
			$Index = $Index + 1
		Next
	EndIf
EndFunction

Function GetUserDistinguishedName($FullName)
	
  $ADS_UF_ACCOUNTDISABLE = 2
	
	$ObjConnectION = CreateObject("ADODB.ConnectION")
	$ObjConnectION.Open("PROVIDER=ADSDSOOBJECT;")
	$ObjCOMMAND = CreateObject("ADODB.COMMAND")
	$ObjCOMMAND.ActiveConnectION = $ObjConnectION
	$ObjCOMMAND.COMMANDTEXT = "<GC://" + $defaultNamingContext + ">;(OBJECTCATEGORY=User);UserACCOUNTCONTROL,DistinguishedName;SUBTREE"
  $ObjRecordset = $ObjCOMMAND.Execute
	While Not $ObjRecordset.EOF
		$POSITIVE = InStr($ObjRecordset.Fields("DistinguishedName"),"CN=" + $FullName)
		If $POSITIVE <> 0
			$ObjUser = GetObject("LDAP://" + $ObjRecordset.Fields("DistinguishedName"))
			$ObjUser.GetInfo
			$GetUserDistinguishedName = $ObjUser.Get("DistinguishedName")
		EndIf
		$ObjRecordset.MoveNext
	Loop
	$ObjConnectION.Close
	
EndFunction




Hello Benny,

please give me a hint, because I am a beginner in coding kixtart, on this error message of the code in your post to test:
ERROR : undefined variable [objRootDSE]!
Script: \\hildesheim\netlogon\test.kix
Line : 14

it is not clear to me, why the variables in the script code are not declared before. Can you help me, please?

regards
stefan

Top
#183669 - 2007-12-14 03:50 PM Re: share mapping with script - strange results [Re: mikeemikee]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
^^ I've got some working code for a ini-layout like that at home that was rewritten by lonkero ^^ - so it's on a diet more or less. I'll see if I can find it.
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
Page 2 of 2 <12


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

Who's Online
0 registered and 628 anonymous users online.
Newest Members
Raoul, Timothy, Jojo67, MaikSimon, kvn317
17875 Registered Users

Generated in 0.065 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