Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Comments

15 comments
Date Votes
  • Hi Mark,

    Are you getting any error back from the deployment? Also, I see two n's that should not be in the command in the screenshot you sent. 

    You may also want to go under the conditions tab of the command step and set the "Logged on State" to "Only Run if a User is Logged On" when using the deploy as "Logged on User" option.

    -Brandon

    0
  • Package returned error code 1, I have switched options but now it seems to gpupdate won't stop and just continues running.

    0
  • Mark,

    Send another screenshot of the command step with the entire command field showing.(So I can see the changes that were made)

    Also, error code 1 means Invalid Function: It indicates that an action has attempted to execute a non-recognized command in Windows command prompt cmd.exe

    -Brandon

    0
  • This is what I currently have and the results.

    0
  • I also just ran into this problem today.

    0
  • Refer to below images. it works for me.

    0
  • Pushpak, how long does it take for the GPUPDATE to complete? I have left it running for over 6 minutes and it never finishes or receives an exit code. I believe that the reboot and logoff questions need to be answered to end the command.

    0
  • Mark,

    The amount of time a gpupdate runs depends upon how many policies need to be updated on the machine.

    If you have updates that require a Logoff or Reboot, you can utilize the /logoff and /boot switches which will perform the respective tasks after the policies are updated.(if no policies were updated that require a logoff or reboot, the /logoff and /boot switches do nothing)

    Here is an example command you can try: gpupdate /force /logoff /boot

     

     

    0
  • I may have found the solution, I don't want the machine logging off or rebooting so to avoid the additional questions I used the /wait: command. 

     

    gpupdate /force /wait:0

     

    This avoids the need provide the answers, I will need to continue testing to verify both user and machine are being updated and not just the machine.

    0
  • Thought gpupdate /force /wait:0 however it doesn't seem too; this has got me stumped.

    0
  • Actually it works fine with the /wait:0 I ended up looking at machines where people were on vacation thus the user portion won't update.

    0
  • Just FYI, Error Code 1 may also be a success message. 

    Most of the custom batch files that i've created end with the error code 1, but the script actually completed fine. 

    Just adding the error code to the list generates a success message instead, of course assuming your command is working. 

    This way you don't get thrown off by the error code itself. 

     

    0
  • GPUPDATE /FORCE /BOOT

    0
  • I use

    echo n | gpupdate /force

    Which pipes No if it asks for user input.

    0
  • I use a vbs script for this

    [code]

    'VB Script for Refreshing GroupPolicy Settings silently
    'Script Version: 0.2
    'Created: 25/11/2010
    'Created By: Joejoeinc.com

    'Define Variables and Objects.
    Set WshShell = CreateObject("Wscript.Shell")

    'Note: Gpupdate command has to be run twice as the ECHO command can't answer more than one question.

    'Refresh the USER policies and also answer no to logoff if asked.
    Result = WshShell.Run("cmd /c echo n | gpupdate /target:user /force",0,true)

    'Refresh the Computer policies and answer no to reboot.
    Result = WshShell.Run("cmd /c echo n | gpupdate /target:computer /force",0,true)

    'Hand back the errorlevel
    Wscript.Quit(Result)

     

    [/code]

    0