TranceAddict Forums

TranceAddict Forums (www.tranceaddict.com/forums)
- Chill Out Room
-- What could stop a logon script from working in AD?


Posted by DJ Mikey Mike on Aug-06-2010 15:20:

What could stop a logon script from working in AD?

I've written a script and I've called it test.bat. I've placed it in the sysvol\scripts folder on the server and put test.bat in the logon script section of AD under the profile tab.

However, when I log on the script is not kicking in. What factors could stop it from running?

I know the script works because if I run it manually in cmd prompt it runs through just fine.

Any ideas?

Cheers.


Posted by ziptnf on Aug-06-2010 15:44:

Shot in the dark, because I obviously have no clue about your setup, but is the path for your script included in your environment variables?


Posted by Jarvmeister on Aug-06-2010 16:09:

Seriously? Asking this Q in the COR?

http://social.microsoft.com/Forums/en-US/categories


Posted by Specimen303 on Aug-06-2010 18:34:

disable fast logon

With fast logon on start up skips some ad policies and startup scripts

To turn off Fast Logon Optimization, you can use the following policy setting:
Computer Configuration\Administrative Templates\System\Logon\ Always wait for the network at computer startup and logon

and remember
gpupdate on server
gpupdate /force on workstation


Posted by Rinster on Aug-06-2010 18:47:

Re: What could stop a logon script from working in AD?

quote:
Originally posted by DJ Mikey Mike
I've written a script and I've called it test.bat. I've placed it in the sysvol\scripts folder on the server and put test.bat in the logon script section of AD under the profile tab.

However, when I log on the script is not kicking in. What factors could stop it from running?

I know the script works because if I run it manually in cmd prompt it runs through just fine.

Any ideas?

Cheers.


Maybe you need to start it up with admin rights if you launch it from the server?..


Posted by DJ Mikey Mike on Aug-09-2010 09:46:

quote:
Originally posted by Specimen303
disable fast logon

With fast logon on start up skips some ad policies and startup scripts

To turn off Fast Logon Optimization, you can use the following policy setting:
Computer Configuration\Administrative Templates\System\Logon\ Always wait for the network at computer startup and logon

and remember
gpupdate on server
gpupdate /force on workstation



You sexy genius.


While I've got you here perhaps you might be able to help me with one more issue I'm having. I have the following line in my script:

copy s:\IT\Technical\scripts\Office2007\NormalTemplates7\Normal.dotm c:\Users\%USERNAME%.BST\AppData\Roaming\Microsoft\Templates\Normal.dotm /Y

If I run that from command prompt on my work station it resolves the %USERNAME%.BST bit as mhoward.BST, as in my username, which is great.

However, as soon as I stick that in a .bat or .cmd file and run it as the logon script from AD, all of a sudden it won't resolve to mhoward.BST - It just stays as USERNAME.BST

Any ideas why it would do that?

Cheers mate.


Posted by Specimen303 on Aug-09-2010 13:30:

sorry not sure I can help here. I'm not really a scripter.

What is .bst?

Can't you just skip that part of the filepath with %appdata%?

so destination file path would be just: %appdata%\Microsoft\Templates\Normal.dotm

(same as: c:\users\%username%\appdata\roaming\Microsoft...)


Posted by DJ Mikey Mike on Aug-09-2010 14:30:

Sorry, I should have specified. The .BST is our domain. When we set a user up we create a local account on the PC which gets the name 'username', for example 'jsmith', and then we add the computer to the domain, where the profile gets called 'username.domain, for example jsmith.BST

The domain account is the one the user will end up using, hence ending up with jsmith.BST as their folder.

How exactly will that %AppData% bit work? Like this?

copy s:\IT\Technical\scripts\Office2007\NormalTemplates7\Normal.dotm %AppData%\Roaming\Microsoft\Templates\Normal.dotm /Y

How would it know what drive to choose without specifying a drive path?

Cheers for your help.


Posted by Specimen303 on Aug-09-2010 16:50:

like this:
copy s:\IT\Technical\scripts\Office2007\NormalTemplates7\Normal.dotm %AppData%\Microsoft\Templates\Normal.dotm /Y

here's a small list of windows environment variables:
http://www.mydigitallife.info/2009/...ment-variables/

use windows explorer (not ie) or open start menu and write on the search bar to test the environment variables. Same environment variables work whether it is xp, vista or 7. Their filepaths differ quite a bit but when you use these variables you don't need to care about that. When you use "c:\..." you have to make sure that every computer has windows installed on c:\. Using e-variables you don't need to write any of filepath before the e-variable you're using.

you could test this also:
copy s:\IT\Technical\scripts\Office2007\NormalTemplates7\Normal.dotm %userprofile%\AppData\Roaming\Microsoft\Templates\Normal.dotm /Y


cheers,

Erno (7x MCTS/4x MCITP)


Posted by WittyHandle on Aug-09-2010 17:05:

Take the game out, blow in it, and try again. Usually works.


Posted by DJ Mikey Mike on Aug-10-2010 08:08:

quote:
Originally posted by Specimen303
like this:
copy s:\IT\Technical\scripts\Office2007\NormalTemplates7\Normal.dotm %AppData%\Microsoft\Templates\Normal.dotm /Y

here's a small list of windows environment variables:
http://www.mydigitallife.info/2009/...ment-variables/

use windows explorer (not ie) or open start menu and write on the search bar to test the environment variables. Same environment variables work whether it is xp, vista or 7. Their filepaths differ quite a bit but when you use these variables you don't need to care about that. When you use "c:\..." you have to make sure that every computer has windows installed on c:\. Using e-variables you don't need to write any of filepath before the e-variable you're using.

you could test this also:
copy s:\IT\Technical\scripts\Office2007\NormalTemplates7\Normal.dotm %userprofile%\AppData\Roaming\Microsoft\Templates\Normal.dotm /Y


cheers,

Erno (7x MCTS/4x MCITP)


%AppData% works great, thank you very much as always


Posted by Sushipunk on Aug-10-2010 08:27:

See, this is why I love the COR.

Mike may be, in fact, the biggest cunt to ever wander these forums. The sheer amount of crying and butt-hurtedness he's left in his wake is surely likely to be worthy of an award or two, possibly even a world record.



Yet, his regular computer/tech/coding questions are almost always answered, with speed and a smile.

We all just love to hate


Posted by infiniteJEST on Aug-10-2010 08:33:

quote:
Originally posted by WittyHandle
Take the game out, blow in it, and try again. Usually works.


Make sure to cover the slot with your shirt, as to avoid saliva buildup.


Posted by DJ Mikey Mike on Aug-11-2010 08:01:

quote:
Originally posted by Sushipunk
See, this is why I love the COR.

Mike may be, in fact, the biggest cunt to ever wander these forums. The sheer amount of crying and butt-hurtedness he's left in his wake is surely likely to be worthy of an award or two, possibly even a world record.



Yet, his regular computer/tech/coding questions are almost always answered, with speed and a smile.

We all just love to hate




Powered by: vBulletin
Copyright © 2000-2021, Jelsoft Enterprises Ltd.