strikey Posted April 22, 2009 Posted April 22, 2009 (edited) Good day , I am trying to make a login script that has to be executed when a user logs on the domain controller aka logon script. I already made this.. but I don't know if I am doing it the good way,I have been searching allot on the forum.. but I cannot find the right answers I also need a msg during logon every Friday to only 1 group in the AD .... expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Me Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here $answer = MsgBox(4, "Melding", "Als u inlogt op dit systeem gaat u er mee accoord dat als u misbruik maakt van het bedrijfsnetwerk dat u zal ontslagen worden op staande voet.") If $answer = 6 Then Msgbox(0, "Acceptatie", "Danku voor het accepteren van de gebruikersovereen komst! ") Exit EndIf If $answer = 7 Then Run("shutdown.exe -l") Exit EndIf NET USE P: \\deodora\$homedir /persistent:yes NET USE X: \\deodora\$installdir /persistent:yes NET USE S: \\deodora\$Afdelingsmappen /persistent:yes NET USE F: \\deodora\$finafd /persistent:yes NET USE W: \\deodora\$directie /persistent:yes plz I need help.. greetings strikey p.s this is a AWESOME tool some really nice apz on the forum Edited April 22, 2009 by strikey
Developers Jos Posted April 22, 2009 Developers Posted April 22, 2009 Scary MsgBox() ... You can use the AD UDF available in the Examples forum to check if the user that is login in is part of a AD group.http://www.autoitscript.com/forum/index.php?showtopic=37378Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
strikey Posted April 22, 2009 Author Posted April 22, 2009 I already read that thread but I dont get it :S Is my script ok? and what does this mean? ( check if the user that is login in is part of a AD group. )... Soz I am a bit of a noob:p
Legacy99 Posted April 22, 2009 Posted April 22, 2009 IMHO - Kixtart would be a better choice for logon script as you can use the INGROUP function. It can also detect nested groups (Groups that are members of other Groups). Autoit can do it but you will need to create a lot of your own code that Kixtart can do in 2 lines. You could call a Kixtart script to enumerate the groups and have it pipe the results back to Autoit if you really wanted to use Autoit and didn't want the learning curve of ADFunctions.au3
99ojo Posted April 23, 2009 Posted April 23, 2009 (edited) IMHO - Kixtart would be a better choice for logon script as you can use the INGROUP function. It can also detect nested groups (Groups that are members of other Groups). Autoit can do it but you will need to create a lot of your own code that Kixtart can do in 2 lines. You could call a Kixtart script to enumerate the groups and have it pipe the results back to Autoit if you really wanted to use Autoit and didn't want the learning curve of ADFunctions.au3Hi, if you have only XP clients in your network, maybe a choice: 1) Put your AD group in a seperate OU in your AD (e.g. MyOU) 2) Create and compile your MSGBOXES in Autoit for every User ; Script Start - Add your code below here $answer = MsgBox(4, "Melding", "Als u inlogt op dit systeem gaat u er mee accoord dat als u misbruik maakt van het bedrijfsnetwerk dat u zal ontslagen worden op staande voet.") If $answer = 6 Then Msgbox(0, "Acceptatie", "Danku voor het accepteren van de gebruikersovereen komst! ") Exit EndIf If $answer = 7 Then Run("shutdown.exe -l") Exit EndIfoÝ÷ Ûp«y«^jw¢jb쨺³(§ëh×è®Þ1«¢êT±êâ|Zâu¬ºÚ"µÍYÑ^HH [ÙÐÞ B[Y 4) Your login script should look like this: autoit compiled 4 every User.exe dsquery user -samid "%username%" |find "CN" | find "MyOU" > nul && goto MyOU goto end :MyOU autoit compiled only for one AD Group.exe :end NET USE P: \\deodora\$homedir /persistent:yes NET USE X: \\deodora\$installdir /persistent:yes NET USE S: \\deodora\$Afdelingsmappen /persistent:yes NET USE F: \\deodora\$finafd /persistent:yes NET USE W: \\deodora\$directie /persistent:yes ;-)) Stefan Edited April 23, 2009 by 99ojo
strikey Posted May 13, 2009 Author Posted May 13, 2009 (edited) if @WDay = 6 Then MsgBox (...........) EndIf this aint working :S I put this in.. but it doenst compile to an exe if @WDay = 5 Then MsgBox ("MELDING" , "Let op! morgen zullen de week rapportages ingeleverd moeten worden") EndIf it says unable to parse line Edited May 13, 2009 by strikey
Developers Jos Posted May 13, 2009 Developers Posted May 13, 2009 Have your installed the Full Scite4AutoIt3 installer which runs au3check everytime to run or compile a script? ERROR: MsgBox() [built-in] called with wrong number of args. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
strikey Posted May 20, 2009 Author Posted May 20, 2009 (edited) Thnx I got that working.. but I needed to expand it.. tried everything.. this is the code I came up with.. but it errors (did the tidy thjing) If @WDAY = 5 Then MsgBox("MELDING", "Let op! morgen zullen de week rapportages ingeleverd moeten worden") EndIf If @WDAY = 6 Then NET USE W: \\deodora\$directie EndIf So on Thursdays they will get an announcement ,and on the next day the appropriate networked drive will open up Edited May 20, 2009 by strikey
ken82m Posted May 20, 2009 Posted May 20, 2009 (edited) You can look at the DriveMapAdd() function to map your drives. DriveMapAdd("W:" , "\\deodora\$directie" , 1) ;(1 = /persistent:yes) But at a minimum your going to have to change those commands to something like ShellExecuteWait("NET USE W: \\deodora\$directie") OR RunWait(@comspec & " /c NET USE W: \\deodora\$directie") AutoIT doesn't know what NET USE is so that's why your getting the errors. For the UDF Jos posted, you would just need one short command like like this If _ADIsMemberOf("USA Group", @username) Then Msgbox(0,"Group Check", "User is a meber of the USA Group") ;whatever commands you want to run. EndIf Kenny Edited May 20, 2009 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."
strikey Posted May 20, 2009 Author Posted May 20, 2009 (edited) Thank you very much for the fast reply.. got the other scripts working tho .. but the *day* script is giving me an error on Thursdays AUTO IT ERROR line-1: error incorrect number of parameters in function call If @WDAY = 5 Then MsgBox("MELDING", "Let op! morgen zullen de week rapportages ingeleverd moeten worden") EndIf If @WDAY = 5 Then RunWait(@ComSpec & " /c NET USE W: \\deodora\$directie") EndIf and for this : CODE If _ADIsMemberOf("USA Group", @username) Then Msgbox(0,"Group Check", "User is a meber of the USA Group") ;whatever commands you want to run. EndIf I used some gpo's and bat files to do the net use commands and the start up thing never mind got it running;) it needed an 0 in front of message box Edited May 20, 2009 by strikey
ken82m Posted May 20, 2009 Posted May 20, 2009 (edited) For this one your just missing the first parameter, Instead of this: MsgBox("MELDING", "Let op! morgen zullen de week rapportages ingeleverd moeten worden") Try this: MsgBox(0, "MELDING", "Let op! morgen zullen de week rapportages ingeleverd moeten worden") For the second one, what's the error exactly, does scite tell you what line or command it is? I used some gpo's and bat files to do the net use commands and the start up thing Cool, love gpo filtering Edited May 20, 2009 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."
strikey Posted May 20, 2009 Author Posted May 20, 2009 (edited) Already got it all working (the message) and the drive mapping .. well I am going to test that now... Yes we all love the all powerful no-nonsense GPO's dammit, Drive mapping aint working atm.. dont know why yet.. gonna post some updates later:P Edited May 20, 2009 by strikey
strikey Posted May 20, 2009 Author Posted May 20, 2009 If @WDAY = 6 Then DriveMapAdd("W:", "\\deodora\Weekrapportages") RunWait(@ComSpec & " /c NET USE W: \\deodora\Weekrapportages") EndIf Is there a way that autoit is not closing the .CMD file? so that I can see momentarily what he is executing and if that is going all right
Developers Jos Posted May 20, 2009 Developers Posted May 20, 2009 If @WDAY = 6 Then DriveMapAdd("W:", "\\deodora\Weekrapportages") RunWait(@ComSpec & " /c NET USE W: \\deodora\Weekrapportages") EndIf Is there a way that autoit is not closing the .CMD file? so that I can see momentarily what he is executing and if that is going all rightreplace /c with /k SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
strikey Posted May 23, 2009 Author Posted May 23, 2009 alright ill try to fix that somewhat later.. gonna try it tomorrow (Sundays ) lol
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now