none
Logon script won't run

    Question

  • Due to size limitations on asking questions I've had to make this a multi-part question

    I am trying to install fonts via login script and GPO.



    Monday, March 21, 2016 6:08 PM

All replies

  • For test purposes Fonts.cmd just creates a log file<o:p></o:p>

    @echo off
    set LOG = /temp/sam.txt
    echo %0 starting %date% at %time% >%LOG%
    echo
    echo moved to network share >>%LOG%
    echo
    echo %0 ending %date% at %time% >%LOG%<o:p></o:p>

    On a test
    machine I do a GPupdate /force and then sign out as the administrator and
    back in, there is no log file in temp. I've tried this as a
    non-administrator as well.. Output from gpresult /v

    <o:p></o:p>

    <o:p></o:p>


    <o:p></o:p>


    Monday, March 21, 2016 6:13 PM
  • Monday, March 21, 2016 6:15 PM
  • There are no errors in the Event Viewer and the script runs fine either as an administrator or non-administrator if I run it manually

    Test machine is running Windows 8.1 Pro and the server is running Windows 2012 Standard

    Can anyone tell me why the script is not running?

    Monday, March 21, 2016 6:16 PM
  • Monday, March 21, 2016 6:20 PM
  • Hi Sam,

    I notice that the GPO "login Script2" has been applied successfully.

    I think there may be something wrong with script.

    If you have any problem relate with script, you could post your problem to script forum.

    https://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=ITCG

    Thanks for your understanding.

    Best Regards,

    Jay


    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, March 22, 2016 3:27 PM
    Moderator
  • Thanks for the response Jay however i have run the script manually both on the server and on the local machine and it works fine. It isn't a complicated script, all it does is create a log file with a start date and and end date.
    Tuesday, March 22, 2016 3:47 PM
  • Hi Sam,

    I have tested for the case.

    The problem may be caused by the path is local path, you could change local path to UNC path like below.

    \\192.168.2.1\\Windows\SYSVOL\sysvol~~~

    OR

    \\Windows12\logonscript\~~~~

    Best Regards,

    Jay


    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, March 23, 2016 3:36 AM
    Moderator
  • why don't u place the script at the \\xxx.com\netlogon folders?
    Wednesday, March 23, 2016 4:20 AM
  • You configured C:\Windows\Sysvol\... as the script path. This path is
    only valid on the DC itself. Replace with \\%userdomain%\netlogon\...
     
    Wednesday, March 23, 2016 9:14 AM
  • If I look on my client machine I have the following path C:\Windows\SYSVOL\sysvol\gls.local\scripts, this is the same path that I have on the DC C:\Windows\SYSVOL\sysvol\gls.local\scripts so I don't see what the problem is with using this path. Additionally I don't have a \\%userdomain%\netlogon\ path on either the client or the DC.
    Thursday, March 24, 2016 6:41 PM
  • If I look on my client machine I have the following path C:\Windows\SYSVOL\sysvol\gls.local\scripts, this is the same path that I have on the DC C:\Windows\SYSVOL\sysvol\gls.local\scripts so I don't see what the problem is with using this path. Additionally I don't have a \\%userdomain%\netlogon\ path on either the client or the DC.

    on the client PC, open Windows Explorer, and in the address bar, type in:

    \\%userdomain%\netlogon\

    This should open up at the netlogon share in Explorer. If this doesn't work, you have a problem with your client ability to connect to your DC/DNS/etc.


    Don [doesn't work for MSFT, and they're probably glad about that ;]

    Thursday, March 24, 2016 11:59 PM
  • For test purposes Fonts.cmd just creates a log file

    @echo off
    set LOG = /temp/sam.txt
    echo %0 starting %date% at %time% >%LOG%
    echo
    echo moved to network share >>%LOG%
    echo
    echo %0 ending %date% at %time% >%LOG%

    On a test
    machine I do a GPupdate /force and then sign out as the administrator and
    back in, there is no log file in temp. I've tried this as a
    non-administrator as well.. 

    >> set LOG = /temp/sam.txt

    this isn't a valid path on Windows... (it's probably totally valid for *nix ;)

    Don [doesn't work for MSFT, and they're probably glad about that ;]


    • Edited by DonPick Friday, March 25, 2016 12:01 AM
    Friday, March 25, 2016 12:01 AM
  • I am trying to install fonts via login script and GPO.

    you may ultimately find this useful (after you get the script launching problem sorted out):
    https://blogs.technet.microsoft.com/heyscriptingguy/2008/04/26/hey-scripting-guy-how-can-i-install-fonts-using-a-script/

    (or, some powershell equivalent)
    (or, use GPSI or something else to perform the font installation task)


    Don [doesn't work for MSFT, and they're probably glad about that ;]

    Friday, March 25, 2016 12:04 AM
  • Hi Don,

    I appreciate the time you are spending helping me. You were spot on with the slashes being in the wrong direction and it turns out that the syntax was also incorrect, spaces are not allowed around the equal sign. Got all of the script stuff resolved and it runs manually. Unfortunately I still can't get it to run as a logon script.

    The path you provided \\%userdomain%\netlogon\ works fine in a browser but not within a command prompt as cmd does not support UNC paths as current directories. Another thing that is making me crazy is that C:\Windows\SYSVOL\sysvol\gls.local\scripts is no longer available on the client machine. Paths that I do have are \\Dc01\sysvol\gls.local\scripts and a number of locations that start with \\Dc01\sysvol\gls.local\Policies\

    By the way I looked at my DNS Manager and the machine name and IP address are registered. I deleted this machine from DNS and it reconnected so I know I'm talking to DNS and the DC.

    Friday, March 25, 2016 7:45 PM
  • C:\Windows\SYSVOL\sysvol\gls.local\scripts is no longer available on the client machine.

    that path would never have been valid on the client machine - because "C:\Windows\SYSVOL\" is an absolute path - the client will regard any reference to "C:\Windows\SYSVOL\" as it's own local C:\ - which will only ever be true on a DC - never true on a client - because client machines don't have their own SYSVOL - SYSVOL only exists on a DC.
    (the rare exception would be if a DC is demoted back to a member server, in this case, SYSVOL remains behind)


    >> cmd does not support UNC paths as current directories.

    Whilst that is true, it's not really relevant, If you write the script so that the cwd is immaterial ;)


    Don [doesn't work for MSFT, and they're probably glad about that ;]

    Saturday, March 26, 2016 5:27 AM
  • Hi Sam,

    Are there any updates?

    Best Regards,

    Jay


    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, March 28, 2016 1:30 AM
    Moderator
  • Quite an obvious question, but can you try removing spaces in this line?

    set LOG = /temp/sam.txt -> set LOG=/temp/sam.txt

    Regards

    Monday, March 28, 2016 12:47 PM
  • Avendil,

    Thanks for pointing out that the spaces needed to be removed, I had done that a while back but forgot to update this discussion with that change.

    Don/Jay,

    So far no luck. I changed the path in the GPO to \\gls\netlogon with it still not working then I changed the path to just the file name and still no luck. When I'm on the client machine I can see the script in \\gls\netlogon. Other things I did without success are that I changed the extension of .cmd to .bat and I wrote the script as a .vbs. All the script does today is just write the date into a log file that it creates in c:\temp

    Monday, March 28, 2016 3:08 PM
  • Nice to hear that.

    Your issue may also be caused by UAT. As you may know, UAT splits your session into two ones. One with the elevated token and one without. But the logon script is run before that happens. So many changes that you can do to the user environment do not save after UAT takes its turn. I am sure that this happens to Network Drives. May be this is also the case for fonts.

    This is an "as designed" behavior described in this article: https://technet.microsoft.com/en-us/library/cc766208%28WS.10%29.aspx?f=255&MSPPError=-2147217396 As the article is rather long you may want to search for the section "Group Policy Scripts can fail due to User Account Control". 

    The article also suggests a Microsoft recommended way to avoid this issue - creating a scheduled task that is triggered immediately after the logon. Can you check if this helps you?

    Most importantly, if you just run the script under the user session manually, does it do what you want with the fonts?

    Regards.





    • Edited by Avendil Monday, March 28, 2016 4:01 PM
    • Proposed as answer by Jay GuModerator Thursday, April 07, 2016 1:06 AM
    Monday, March 28, 2016 4:00 PM
  • Any news? Did it work?

    Regards

    Saturday, April 02, 2016 8:44 AM
  • Thanks for following up with me Avendil unfortunately I've been fighting other fires since I got your response. I'm hoping to be able to get to reading the article you sent me this week and testing to see if it resolves the issue I'm having.
    Monday, April 04, 2016 8:13 PM