#209556 - 2014-10-21 05:38 PM
Launch main script manually but secondary script not executed
|
yellowdog
Starting to like KiXtart
Registered: 2005-06-14
Posts: 102
|
Hello,
I have a main script that is calling others script based on the @primarygroup. All my scripts are located in the \\DomainServer\Netlogon share, and work fine at logon.
But I'd like to run manually the same script. When I run the main script manually the call to others script does not work.
What's the solution to my problem ?
Thanks.
|
|
Top
|
|
|
|
#209557 - 2014-10-21 05:44 PM
Re: Launch main script manually but secondary script not executed
[Re: yellowdog]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
|
|
Top
|
|
|
|
#209564 - 2014-10-22 10:24 AM
Re: Launch main script manually but secondary script not executed
[Re: ChristopheM]
|
yellowdog
Starting to like KiXtart
Registered: 2005-06-14
Posts: 102
|
I think that the problem I encounter is related to the Scriptdir macro.
In fact I try to execute my main script that is located on the \\DomainDC\netlogon from aworkstation where the logon process is already performed.
I created a little script invoking the main script on NETLOGON share, and when I display the @scriptdir from this script, it display the local directory from the workstation C:\TEMP instead of \\DomainDC\netlogon. That's why it cannot chain the others scripts located on NETLOGON.
Is there a way to initialize the @scriptdir macro to a certain value ?
|
|
Top
|
|
|
|
#209566 - 2014-10-22 10:51 AM
Re: Launch main script manually but secondary script not executed
[Re: Mart]
|
yellowdog
Starting to like KiXtart
Registered: 2005-06-14
Posts: 102
|
I changed all my call from my main script to: CALL @LDRIVE\2nd_script.kix CALL @LDRIVE\3rd_script.kix ....... But it doesn't change, now the problem is linked with the @primarygroup which is blanked.
I inserted the UDF in the main script and the UDF returns: "defaultNamingContext1"
What do you suggest me to do.
Edited by yellowdog (2014-10-22 11:45 AM)
|
|
Top
|
|
|
|
#209567 - 2014-10-22 01:06 PM
Re: Launch main script manually but secondary script not executed
[Re: yellowdog]
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
|
During the logon process, the NetLogon folder is in the System PATH, thus, Kix scripts run without issue. After logon, this folder is not in the path.
There's no issue with @SCRIPTDIR if you're calling Kix locally but specifying the path to the scripts.. It's the directory where you called kix from, not where Kix or scripts are. For that, you need @STARTDIR.
Try running from the netlogon share directly: \\DOMAIN\NetLogon\Kix32 \\DOMAIN\NetLogon\MainKixScript.kix where "DOMAIN" is your local AD domain name.
My login script dumps info when debug mode is active, and you can see the results of these macros: During logon: Logon Mode: 1
Laptop: 0
Detected O/S: Windows 8 Professional Edition / Version 6.2
Privelege: USER
Local Privelege: User
ScriptDir: C:\Windows\system32 / C:\Windows\system32
StartDir: \\Ihwiadcp01\netlogon CMD Prompt after logon: Logon Mode: 0
Laptop: 0
Detected O/S: Windows 8 Professional Edition / Version 6.2
Privelege: USER
Local Privelege: User
ScriptDir: \\itcg\netlogon / \\itcg\netlogon
StartDir: \\itcg\netlogon This should properly set the @STAPTDIR macro because you're calling kix32 from the same place as your scripts. The @SCRIPTDIR isn't even relevant during logon! Note that @SCRIPTDIR is effectively the same - when logging in, it's the specific DC that processed the logon, while run later, it's the DOMAIN path (Any DC).
Thus - STARTDIR is what you should use to call your scripts from the NetLogon folder. 
Glenn
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
#209576 - 2014-10-23 10:25 AM
Re: Launch main script manually but secondary script not executed
[Re: ChristopheM]
|
yellowdog
Starting to like KiXtart
Registered: 2005-06-14
Posts: 102
|
Maybe I forgot to tell you that I launch manually the script after having initiated a VPN connection from a laptop to the domain.
Thanks for all of you guys to help me solve that problem. I changed in my main script the call to others script using the @startdir macro, but still does not work.
I have access to the \\Domain\netlogon share, but my main script is linked with the user's primarygroup, then according to the primarygroup tested it calls an other script.
Then my major problem is to detect that primarygroup that remains blank when I launch the script manually. I tested also the UDF script but the result is the same.
An LDAP request would not be the solution instead of a WinNt ?
Is there a solution to my problem ?
Edited by yellowdog (2014-10-23 11:59 AM)
|
|
Top
|
|
|
|
#209579 - 2014-10-23 05:46 PM
Re: Launch main script manually but secondary script not executed
[Re: Allen]
|
yellowdog
Starting to like KiXtart
Registered: 2005-06-14
Posts: 102
|
I configured the LMHOST file but nothing changed. Still having problems executing the NETLOGON script.
Attached is the script.
; *******************************************************
; * SCRIPT PAR DEFAUT *
; *******************************************************
SETCONSOLE(SHOW)
IF INGROUP("GRP_CPTR_GB") <> 0
REDIRECTOUTPUT ("\\STSANSI1\Profils\@USERID\Script.log", 1)
ELSE
REDIRECTOUTPUT ("%USERPROFILE%\Script.log", 1)
ENDIF
$D=@DOMAIN
$S=@LSERVER
$U=@USERID
$version=@DOS
$NbErreur = 0
;***************************************************************************************************************
; Suppression de la valeur CodeBaseSearchPath qui ouvre une connexion sur internet à l'ouverture du client NOTES
; et Suppression de la case à cocher pour l'enregistrement du mot de passe à l'authentification du PROXY
;***************************************************************************************************************
IF $version = "5.0" or $version = "5.1" or $version = "6.1"
DelValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings","CodeBaseSearchPath")
shell "cscript.exe \\G2K8ARB01\netlogon\DisablePasswordCache.VBS"
ELSE
ENDIF
IF INGROUP("GRP_PROXY_NOSCRIPT") <> 0
EXIT
ENDIF
$CITRIX = @WKSTA
IF $CITRIX="G2K3CIT1" OR $CITRIX="G2K3CIT2" OR $CITRIX="G2K3CIT3" OR $CITRIX="G2K3CIT4"
; ajout d'une variable d'environnement pour TERMINAL SERVEUR
; nous déplacerons ensuite DANS LES GROUPES SI BESOIN
; "connaissance du nom de l'utilisateur par terminal serveur"
WriteValue("HKEY_CURRENT_USER\Environment", "TSNAME", "", "REG_SZ")
WriteValue("HKEY_CURRENT_USER\Environment", "TSNAME", "$U", "REG_SZ")
EXIT
ELSE
ENDIF
$SRVNAME = @WKSTA
IF $SRVNAME="V2K3GOUV2" OR $SRVNAME="V2K3CITAPP01" OR $SRVNAME="V2K3CITAPP02" OR $SRVNAME="V2K3CITDC" OR $SRVNAME="G2K8DL01"
EXIT
ELSE
ENDIF
;***********************************************************************
; Récupération de l'heure du domaine
;***********************************************************************
IF $SRVNAME="V2K3CITDK01"
GOTO SKIPTIME
ENDIF
SETTIME "$S"
IF @ERROR = 0
"Récupération de l'heure sur le serveur"
ELSE
"Heure domaine non récupérée : erreur " @ERROR
$NbErreur = $NBErreur + 1
ENDIF
:SKIPTIME
? "Connexion au domaine $D le @MDAYNO/@MONTHNO/@YEAR à @TIME"
? "Serveur d'authentification : $S"
? "Groupe utilisateur : " @PRIMARYGROUP
? "Version de l'OS = "$version
;**********************************************************************
; Paramètres internationnaux
;**********************************************************************
$Row = ReadValue("HKEY_CURRENT_USER\Control Panel\International", "sDecimal")
IF @ERROR <> 0
? "sDecimal erreur : " @ERROR
$NbErreur = $NBErreur + 1
ENDIF
IF $Row <> ","
WriteValue("HKEY_CURRENT_USER\Control Panel\International", "sDecimal", ",", "REG_SZ")
IF @ERROR = 0
? " Nouvelle valeur sDecimal : ,"
ELSE
? "Erreur sur écriture clé sDecimal, erreur : " @ERROR
$NbErreur = $NBErreur + 1
ENDIF
ENDIF
$Row = ReadValue("HKEY_CURRENT_USER\Control Panel\International", "sThousand")
IF @ERROR <> 0
? "sThousand erreur : " @ERROR
$NbErreur = $NBErreur + 1
ENDIF
IF $Row <> " "
WriteValue("HKEY_CURRENT_USER\Control Panel\International", "sThousand", " ", "REG_SZ")
IF @ERROR = 0
? " Nouvelle valeur sThousand : "
ELSE
? "Erreur sur écriture clé sThousand, erreur : " @ERROR
$NbErreur = $NBErreur + 1
ENDIF
ENDIF
$Row = ReadValue("HKEY_CURRENT_USER\Control Panel\International", "sMonDecimalSep")
IF @ERROR <> 0
? "sMonDecimalSep erreur : " @ERROR
$NbErreur = $NBErreur + 1
ENDIF
IF $Row <> ","
WriteValue("HKEY_CURRENT_USER\Control Panel\International", "sMonDecimalSep", ",", "REG_SZ")
IF @ERROR = 0
? " Nouvelle valeur sMonDecimalSep : ,"
ELSE
? "Erreur sur écriture clé sMonDecimalSep, erreur : " @ERROR
$NbErreur = $NBErreur + 1
ENDIF
ENDIF
$Row = ReadValue("HKEY_CURRENT_USER\Control Panel\International", "sMonThousandSep")
IF @ERROR <> 0
? "sMonThousandSep erreur : " @ERROR
$NbErreur = $NBErreur + 1
ENDIF
IF $Row <> " "
WriteValue("HKEY_CURRENT_USER\Control Panel\International", "sMonThousandSep", " ", "REG_SZ")
IF @ERROR = 0
? " Nouvelle valeur sMonThousandSep : "
ELSE
? "Erreur sur écriture clé sMonThousandSep, erreur : " @ERROR
$NbErreur = $NBErreur + 1
ENDIF
ENDIF
$Row = ReadValue("HKEY_CURRENT_USER\Control Panel\International", "sList")
IF @ERROR <> 0
? "sList erreur : " @ERROR
$NbErreur = $NBErreur + 1
ENDIF
IF $Row <> ";"
WriteValue("HKEY_CURRENT_USER\Control Panel\International", "sList", ";", "REG_SZ")
IF @ERROR = 0
? " Nouvelle valeur sList : ;"
ELSE
? "Erreur sur écriture clé sList, erreur : " @ERROR
$NbErreur = $NBErreur + 1
ENDIF
ENDIF
;*********************************************************************
; Groupes
;*********************************************************************
IF $U="pppp"
CALL @SCRIPTDIR\GRPCATIA_PPPP.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPNOBAT") <> 0
CALL @SCRIPTDIR\GRPNOBAT.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPACHATS") <> 0
CALL @SCRIPTDIR\GRPACHATS.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPCOMDPC") <> 0
CALL @SCRIPTDIR\GRPCOMDPC.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPCOMMERCE") <> 0
CALL @SCRIPTDIR\GRPCOMMERCE.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPCOMPTA") <> 0
CALL @SCRIPTDIR\GRPCOMPTA.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPDG") <> 0
CALL @SCRIPTDIR\GRPDG.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPDRH") <> 0
CALL @SCRIPTDIR\GRPDRH.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPETUDES") <> 0
CALL @SCRIPTDIR\GRPETUDES.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPFINANCE") <> 0
CALL @SCRIPTDIR\GRPFINANCE.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPGESTION") <> 0
CALL @SCRIPTDIR\GRPGESTION.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPINFO") <> 0
CALL @SCRIPTDIR\GRPINFO.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPCATIA") <> 0
CALL @SCRIPTDIR\GRPCATIA.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPSUPCHAIN") <> 0
CALL @SCRIPTDIR\GRPSUPCHAIN.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRP_BDR") <> 0
CALL @SCRIPTDIR\GRP_BDR.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPCER") <> 0
CALL @SCRIPTDIR\GRPCER.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPCH") <> 0
CALL @SCRIPTDIR\GRPCH.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPDL") <> 0
CALL @SCRIPTDIR\GRPDL.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPENTPL") <> 0
CALL @SCRIPTDIR\GRPENTPL.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPES") <> 0
CALL @SCRIPTDIR\GRPES.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPIT") <> 0
CALL @SCRIPTDIR\GRPIT.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPNL") <> 0
CALL @SCRIPTDIR\GRPNL.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPPARIS") <> 0
CALL @SCRIPTDIR\GRPPARIS.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPREPRO") <> 0
CALL @SCRIPTDIR\GRPREPRO.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPPRODDPC") <> 0
CALL @SCRIPTDIR\GRPPRODDPC.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPPRODDPE") <> 0
CALL @SCRIPTDIR\GRPPRODDPE.kix
$Groupe = "OK"
ENDIF
IF INGROUP("GRPPRODDPI") <> 0
CALL @SCRIPTDIR\GRPPRODDPI.kix
$Groupe = "OK"
ENDIF
;*********************************************************************
; Message box
;*********************************************************************
IF $Groupe <> "OK"
? "Pas de fichier script pour le groupe"
MESSAGEBOX("Aucun script n'est associé au groupe : @PRIMARYGROUP,
Contactez l'administrateur du réseau", "Script de lancement", 64)
ELSE
If $NbErreur = 0
MESSAGEBOX ("Bienvenue dans le domaine @DOMAIN, contrôleur local @LSERVER
. . .
Lancement OK",
"Script de lancement", 64)
ELSE
MESSAGEBOX ("Bienvenue dans le domaine @DOMAIN, contrôleur local @LSERVER
. . .
$NbErreur anomalie(s) détectée(s) lors du lancement
Contactez l'administrateur du réseau
. . .",
"Script de lancement", 16)
ENDIF
ENDIF
?
EXIT
|
|
Top
|
|
|
|
#209586 - 2014-10-27 03:31 PM
Re: Launch main script manually but secondary script not executed
[Re: Glenn Barnas]
|
yellowdog
Starting to like KiXtart
Registered: 2005-06-14
Posts: 102
|
Thanks Glenn for your help.
I ran your script, and the membership is OK for the user. Then I modified the script with the recommendations of Lonkero, and now I'm facing a problem with the error 1265 when trying to mount the differents shares.
1265 ERROR_DOWNGRADE_DETECTED The system detected a possible attempt to compromise security. Please ensure that you can contact the server that authenticated you.
I checked my Domain Controller Policy and verified that the following GPO is already set.
1.Logon to a Windows Server 2008-based domain controller.
2.Click Start, Run, type gpmc.msc, and then click OK.
3.In the Group Policy Management console, expand Forest: DomainName, Controller, Domain Controllers, right-click Default Domain Controllers Policy, and then click Edit.
4.In the Group Policy Management Editor console, expand Computer Configuration, Policies, Administrative Templates, System, click Net Logon, and then double-click Allow cryptography algorithms compatible with Windows NT 4.0.
Any idea?
We're close to succeed (I hope) ........
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|