Jump to content

Logon Scripts Via Group Policy


Recommended Posts

I've got a fair amount of scripts that I've created over time that I want to keep in one central location. I have a windows based network, all servers runninng Win2003 SP2 R2. I use DFS to make sure all the servers have the scripts as well as centralizing the network paths to our shares. To give an example I have the scripts located at \\corp.lan\dfs\tech\scripts\bin, it also has a copy of the autoit executable. The scripts are not compiled, and I would like to keep them that way so editing isn't such a chore. My goal was to be able to use GPO's to run these based on security filtering, with the autoit executable being the script and the script being the parameters, like so:

\\corp.lan\dfs\tech\scripts\bin\autoit.exe script.au3

Now if the user is logged on that works as expected, at least from cmd. However when I run it via GPO, as a user logon script, I get an error about reading line 0, saying it can't find the file. I'll get a more verbose copy of the error message shortly.

I don't want to copy the script to the NETLOGON or SYSVOL shares, because then I'm gonna have multiple versions. And I would like to stay away from running compiled scripts for various reasons. Is anyone else doing something like this?

I did find this forum post:

http://www.autoitscript.com/forum/index.php?showtopic=28378

Which seems to have similar issues, but I don't how to impliment the solution of using @temp. I have several files that are setup as UDF's, which are included in other scripts which are what I'm trying to run via GPO. A more visual representation:

\\corp.lan\dfs\tech\scripts\bin\

_UDF1.au3

_UDF2.au3

_UDF3.au3

autoit3.exe

script1.au3

script2.au3

So the GPO is running autoit3.exe as the script, with script1.au3 as the parameter, which would #include _UDF1.au3. When I #include _UDF1.au3 I'm using the "" around the filename so it looks in the same dir as the script:

#include "_UDF1.au3"

I'll try and get some more info and scripts to provide some investigation, but seems like this is a pretty simple problem that I'm just not noticing. Again, if a user is logged in it works. I've also tried using mapped drives instead of UNC's and that doesn't fair any better. Thanx in advance!!!

Link to comment
Share on other sites

  • Developers

My guess would be that running it from the CMD prompt the Workdir is set to the scriptdir which isn't the case running it via a GPO?

Have you tried running it like this:

\\corp.lan\dfs\tech\scripts\bin\autoit.exe \\corp.lan\dfs\tech\scripts\bin\script.au3

Edited by JdeB

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.
  :)

Link to comment
Share on other sites

I did try that and I think that was when I got the error I mention above...

\\corp.lan\dfs\tech\scripts\bin\autoit3.exe script1.udf = could not find script at all

\\corp.lan\dfs\tech\scripts\bin\autoit3.exe \\corp.lan\dfs\tech\scripts\bin\script1.au3 = found script but error at line 0

I'm not at work at the moment so I can't play, but I've got a whole weekend to figure this out.

Maybe this is a better question, what would be the most reliable way to establish a workingdir for this kinda scenario. Would that be something I edit in the UDF's or the actual scripts? Hmmm

Link to comment
Share on other sites

After digging through the forums a little more I found this:

http://www.autoitscript.com/forum/index.ph...0814&hl=gpo

Looks like a guy had a script that was working fine until recently...it doesn't say if he updated his autoit but I wonder if the mechanics for the workingdir have changed recently. Seems like his issue is similar to mine, as well as the previous post. Anyone have any info regarding that? I' guess I could check the release notes, I might do that and see what I can find...or it could be totally unrelated, can't rule that out!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...