#183393 - 2007-12-07 03:26 PM
Re: share mapping with script - strange results
[Re: Howard Bullock]
|
mikeemikee
Fresh Scripter
Registered: 2007-06-12
Posts: 23
Loc: Germany, Hildesheim
|
Logically your FOR loop is the problem 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
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"
|
Top
|
|
|
|
#183395 - 2007-12-07 03:42 PM
Re: share mapping with script - strange results
[Re: Benny69]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
I did not read all of the posts Just a quick question
C:\>\\hildesheim\netlogon\kix32 \\hildesheim\netlogon\test.kix /f Do you want to clear the tokencache? If yes, I think you should write
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
Fresh Scripter
Registered: 2007-06-12
Posts: 23
Loc: Germany, Hildesheim
|
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
Fresh Scripter
Registered: 2007-06-12
Posts: 23
Loc: Germany, Hildesheim
|
I did not read all of the posts Just a quick question C:\>\\hildesheim\netlogon\kix32 \\hildesheim\netlogon\test.kix /f Do you want to clear the tokencache? If yes, I think you should write 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
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
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
|
Top
|
|
|
|
#183401 - 2007-12-07 04:00 PM
Re: share mapping with script - strange results
[Re: mikeemikee]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
doh! didn't notice BA BH not the same
|
Top
|
|
|
|
#183404 - 2007-12-07 04:37 PM
Re: share mapping with script - strange results
[Re: Benny69]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Sorry, I have to review my answer Yes, it is the same.
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
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
Fresh Scripter
Registered: 2007-06-12
Posts: 23
Loc: Germany, Hildesheim
|
Hi mikeemikee, lets try a little different approch, run this:
$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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 366 anonymous users online.
|
|
|