|
|
|||||||
Hello! my problem is following. I use a script to map network shares. that script Code: $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 $iIndex=0 $sGroup=EnumGroup($iIndex) ;While $sGroup AND Not @FEHLER DO 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 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 uses a in-File (excerpt of it) Code: [LOCATION [LOCATION EDV_map] it=I:| "\\network.local\dfs01\it" Output: Code: [color:#FF0000]DEBUG: Suche nach Sektion [LOCATION EDV_map] Mappe Netzwerkpfad "\\network.local\dfs01\it" auf Y: 0 1. Statement OK Fehlercode im it : 0[/color] DEBUG: Suche nach Sektion [LOCATION Ctx-Admin-Tools] DEBUG: Suche nach Sektion [LOCATION EDV_print] [color:#FF0000]DEBUG: Suche nach Sektion [LOCATION EDV_map] Mappe Netzwerkpfad "\\network.local\dfs01\it" auf Y: 0 1. Statement OK Fehlercode im it : 0[/color] DEBUG: Suche nach Sektion [LOCATION SAP-Gruppe-REWE] The script runs two times in the section "it". I do not know, why it does. Does anyone of you know why? Regards Stefan |
||||||||
|
|
|||||||
[LOCATION [LOCATION EDV_map] In your Ini snipet, You have mismatched brackets. Is this a typo? |
||||||||
|
|
|||||||
Oh, that is an mistake in writing the post. [LOCATION EDV_map] is the entry in the ini-file. |
||||||||
|
|
|||||||
Why do you have @CRLF after the USE commands? Quote: USE LIST @CRLF USE * /DELETE @CRLF |
||||||||
|
|
|||||||
I noticed that when I test the ENUMGROUP loop I do get an execution of the loop when the group seems to be empty. Add a line to output the group name just after "If $sShare" ? "Debug group name + share: " + $sGroup + " ~ " + $sShare What are the results when you see the double execution? |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
Originally Posted By: Howard Bullock Why do you have @CRLF after the USE commands? Quote: USE LIST @CRLF USE * /DELETE @CRLF I used it, in order to set a new line after the "use list" output. |
||||||||
|
|
|||||||
Ooopppsss i missed something in there I have updated my previous post to reflect the change, try it now |
||||||||
|
|
|||||||
Originally Posted By: Howard Bullock I noticed that when I test the ENUMGROUP loop I do get an execution of the loop when the group seems to be empty. Add a line to output the group name just after "If $sShare" ? "Debug group name + share: " + $sGroup + " ~ " + $sShare What are the results when you see the double execution? After the line of code, the results are the follwing: C:\>\\hildesheim\netlogon\kix32 \\hildesheim\netlogon\addnet_DH.kix /f Current redirections : Y: --> \\hildesheim\dfs01\it B: --> \\fs01\home$\dhssen HILDESHEIM\Domänen-Benutzer Jeder DH-PC-IT-08\Administratoren DH-PC-IT-08\Benutzer INTERAKTIV Authentifizierte Benutzer Diese Organisation LOKAL HILDESHEIM\DV-Postfach HILDESHEIM\LKH_Info_map Debug group name + share: LKH_Info_map ~ lkhinfo Mappe Netzwerkpfad "\\hildesheim\dfs01\LKHInformation" auf X: 0 1. Statement OK Fehlercode im lkhinfo : 0 HILDESHEIM\FB-I-SD-BrunieText HILDESHEIM\VW-DV-Organisation-DV-Webadmin HILDESHEIM\VW-ZugriffEtagendruckerG1 HILDESHEIM\Ctx-Zugriff-Corel HILDESHEIM\EDV-Daten HILDESHEIM\EDV HILDESHEIM\DH-SIGMA HILDESHEIM\VW-DV-Organisation HILDESHEIM\VW-Alle HILDESHEIM\Zugriff-Apotheken-Programm HOLSTEIN\Sigma_Universal HOLSTEIN\Sigma_DH HILDESHEIM\LKH_Info_map Debug group name + share: LKH_Info_map ~ lkhinfo Mappe Netzwerkpfad "\\hildesheim\dfs01\LKHInformation" auf X: 0 1. Statement OK Fehlercode im lkhinfo : 0 HILDESHEIM\Ctx-Zugriff-Corel HILDESHEIM\VW-DV-Organisation-DV-Webadmin HILDESHEIM\EDV HILDESHEIM\Zugriff-Apotheken-Programm HILDESHEIM\VW-Alle HILDESHEIM\DHSSEN HILDESHEIM\FB-I-SD-BrunieText HILDESHEIM\DV-Postfach HILDESHEIM\VW-ZugriffEtagendruckerG1 HILDESHEIM\VW-DV-Organisation HILDESHEIM\Zugriff-SAP-Testsystem HILDESHEIM\SAP-Gruppe-REWE HILDESHEIM\Verw_print HILDESHEIM\Zugriff-Plotter HILDESHEIM\Ctx-cmd HILDESHEIM\EDV_map Debug group name + share: EDV_map ~ it Mappe Netzwerkpfad "\\hildesheim\dfs01\it" auf Y: 0 1. Statement OK Fehlercode im it : 0 HILDESHEIM\Ctx-Admin-Tools HILDESHEIM\EDV_print HILDESHEIM\EDV_map Debug group name + share: EDV_map ~ it Mappe Netzwerkpfad "\\hildesheim\dfs01\it" auf Y: 0 1. Statement OK Fehlercode im it : 0 HILDESHEIM\SAP-Gruppe-REWE HILDESHEIM\Zugriff-SAP-Testsystem HILDESHEIM\Ctx-cmd HILDESHEIM\Ctx-Admin-Tools HILDESHEIM\EDV_print HILDESHEIM\Zugriff-Plotter HILDESHEIM\Verw_print Verbindliche Beschriftung\Mittlere Verbindlichkeitsstufe Benutzer B ist angehaengt0 Fehlercode: 0 Current redirections : Y: --> \\hildesheim\dfs01\it B: --> \\fs01\home$\dhssen |
||||||||
|
|
|||||||
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 hm, I get this error: ERROR : undefined variable [objRootDSE]! Script: \\hildesheim\netlogon\test.kix Line : 14 |
||||||||
|
|
|||||||
Hi Benny, that`s is the output: C:\>\\hildesheim\netlogon\kix32 \\hildesheim\netlogon\test.kix /f Current redirections : B: --> \\fs01\home$\dhssen PrimaryGroupIDMemberOfDEBUG: Suche nach Sektion [LOCATION ] B ist angehaengt0 Fehlercode: 0 Current redirections : B: --> \\fs01\home$\dhssen |
||||||||
|
|
|||||||
are you doing somthing like: Code: $SO=SetOption("Explicit", "ON") if you are rem it for testing the code i provided: Code: ;$SO=SetOption("Explicit", "ON") |
||||||||
|
|
|||||||
Originally Posted By: Benny69 are you doing somthing like: Code: $SO=SetOption("Explicit", "ON") if you are rem it for testing the code i provided: Code: ;$SO=SetOption("Explicit", "ON") That is not defined. |
||||||||
|
|
|||||||
i am sorry i don't know German, if you could translate it would help, and does it look like it is only running thru once like you want? |
||||||||
|
|
|||||||
The output shows that the same value for $sGroup is processed twice. However we did not include the Index value to see if it had change. Quote: Debug group name + share: LKH_Info_map ~ lkhinfo followed by Debug group name + share: LKH_Info_map ~ lkhinfo Please run the following code and post the results. It will just display the groups that ENUMGROUP lists along with a counter. I am trying to determine why the group value is not different the second time thorugh the loop. Code: $Index = 0 $x=0 DO $x = 1 + $x ? $x $Group = ENUMGROUP($Index) " " + $Index + ":" + $Group $Index=$Index+1 UNTIL Len($Group) = 0 |
||||||||
|
|
|||||||
wait, are you using Active Directory, if not i need to re-work the code i provided. |
||||||||
|
|
|||||||
Originally Posted By: Benny69 i am sorry i don't know German, if you could translate it would help, and does it look like it is only running thru once like you want? Hi benny, sorry for the german passages, i have translated the into english. C:\>\\hildesheim\netlogon\kix32 \\hildesheim\netlogon\test.kix /f Current redirections : No entries in list. PrimaryGroupIDMemberOfDEBUG: Locating section [LOCATION ] Error55 Errorcode: 55 Current redirections : No entries in list. --- It seems that it loops in the MemberOfArray() function without results. |
||||||||
|
|
|||||||
Originally Posted By: Benny69 wait, are you using Active Directory, if not i need to re-work the code i provided. Yes, there is active directory present. (window s2003) |
||||||||
|
|
|||||||
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? |
||||||||
|
|
|||||||
Originally Posted By: Howard Bullock The output shows that the same value for $sGroup is processed twice. However we did not include the Index value to see if it had change. Quote: Debug group name + share: LKH_Info_map ~ lkhinfo followed by Debug group name + share: LKH_Info_map ~ lkhinfo Please run the following code and post the results. It will just display the groups that ENUMGROUP lists along with a counter. I am trying to determine why the group value is not different the second time thorugh the loop. Code: $Index = 0 $x=0 DO $x = 1 + $x ? $x $Group = ENUMGROUP($Index) " " + $Index + ":" + $Group $Index=$Index+1 UNTIL Len($Group) = 0 Hi Howard, that is the output of your code: 1 :HILDESHEIM\Domänen-Benutzer 2 1:Jeder 3 2:DH-PC-IT-08\Administratoren 4 3:DH-PC-IT-08\Benutzer 5 4:INTERAKTIV 6 5:Authentifizierte Benutzer 7 6:Diese Organisation 8 7:LOKAL 9 8:HILDESHEIM\DV-Postfach 10 9:HILDESHEIM\LKH_Info_map 11 10:HILDESHEIM\FB-I-SD-BrunieText 12 11:HILDESHEIM\VW-DV-Organisation-DV-Webadmin 13 12:HILDESHEIM\VW-ZugriffEtagendruckerG1 14 13:HILDESHEIM\Ctx-Zugriff-Corel 15 14:HILDESHEIM\EDV-Daten 16 15:HILDESHEIM\EDV 17 16:HILDESHEIM\DH-SIGMA 18 17:HILDESHEIM\VW-DV-Organisation 19 18:HILDESHEIM\VW-Alle 20 19:HILDESHEIM\Zugriff-Apotheken-Programm 21 20:HOLSTEIN\Sigma_Universal 22 21:HOLSTEIN\Sigma_DH 23 22:HILDESHEIM\LKH_Info_map 24 23:HILDESHEIM\Ctx-Zugriff-Corel 25 24:HILDESHEIM\VW-DV-Organisation-DV-Webadmin 26 25:HILDESHEIM\EDV 27 26:HILDESHEIM\Zugriff-Apotheken-Programm 28 27:HILDESHEIM\VW-Alle 29 28:HILDESHEIM\DHSSEN 30 29:HILDESHEIM\FB-I-SD-BrunieText 31 30:HILDESHEIM\DV-Postfach 32 31:HILDESHEIM\VW-ZugriffEtagendruckerG1 33 32:HILDESHEIM\VW-DV-Organisation 34 33:HILDESHEIM\Zugriff-SAP-Testsystem 35 34:HILDESHEIM\SAP-Gruppe-REWE 36 35:HILDESHEIM\Verw_print 37 36:HILDESHEIM\Zugriff-Plotter 38 37:HILDESHEIM\Ctx-cmd 39 38:HILDESHEIM\EDV_map 40 39:HILDESHEIM\Ctx-Admin-Tools 41 40:HILDESHEIM\EDV_print 42 41:HILDESHEIM\EDV_map 43 42:HILDESHEIM\SAP-Gruppe-REWE 44 43:HILDESHEIM\Zugriff-SAP-Testsystem 45 44:HILDESHEIM\Ctx-cmd 46 45:HILDESHEIM\Ctx-Admin-Tools 47 46:HILDESHEIM\EDV_print 48 47:HILDESHEIM\Zugriff-Plotter 49 48:HILDESHEIM\Verw_print 50 49:Verbindliche Beschriftung\Mittlere Verbindlichkeitsstufe 51 50:Benutzer 52 51: And you are right, there are double entries for EDV_map. hmm... |
||||||||
|
|
|||||||
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" |
||||||||
|
|
|||||||
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" |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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? |
||||||||
|
|
|||||||
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? |
||||||||
|
|
|||||||
will be back on monday, have all a nice weekend. |
||||||||
|
|
|||||||
Originally Posted By: mikeemikee Isn`t it the same? |
||||||||
|
|
|||||||
doh! didn't notice BA BH not the same |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
Hello, back again, wish you a new good start in the week! stefan |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
^^ 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. |