return to tranceaddict TranceAddict Forums Archive > Main Forums > Chill Out Room

Pages: [1] 2 
What could stop a logon script from working in AD?
View this Thread in Original format
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.
ziptnf
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?
Jarvmeister
Seriously? Asking this Q in the COR?

http://social.microsoft.com/Forums/en-US/categories
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 :D
Rinster
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?..
DJ Mikey Mike
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 :D



You sexy genius. :D


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.
Specimen303
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...)
DJ Mikey Mike
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.
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)
WittyHandle
Take the game out, blow in it, and try again. Usually works.

DJ Mikey Mike
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 :D
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 :gsmile:
CLICK TO RETURN TO TOP OF PAGE
Pages: [1] 2 
Privacy Statement