Share via

Cannot set system time in powershell despite adjusting the local security policy

Anonymous
2021-06-15T20:06:08+00:00

When trying to run Set-Date in my powershell script it fails because it claims to require more permissions. I have added the groups Users and even Everyone to the Adjust system time Local Security Policy. There are no group policies at all so that shouldn't be a problem. Of course I could run it elevated to admin, but I'm trying to avoid that. What's extra odd is that this script has worked fine so far on some machines.

Powershell version is 5.1, windows version is 10 Enterprise 2016 (v1607)

The error message:

PS > Set-Date "2021-06-07T10:00"
Set-Date : Klienten har ikke nødvendig tilgangsnivå
At line:1 char:1
+ Set-Date "2021-06-07T10:00"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-Date], Win32Exception
    + FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Com

Just to be sure, I get the same issue when trying to use SetSystemTime() in C#.
Windows for home | Windows 10 | Settings

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2021-06-15T20:57:41+00:00

    I'm glad to help, wish I could do more.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2021-06-15T20:49:19+00:00

    Will do, thank you

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2021-06-15T20:45:22+00:00

    Hi Henrik. I'm Greg, an Independent Advisor.

    You've reached Microsoft Community Forums which is strictly a consumer forums. For questions about Enterprise which is only for business, please ask at our sister forums for IT Professionals, Q&A forums, as Community is strictly an end-consumer forum. Go here: https://docs.microsoft.com/en-us/answers/index....

    There are also good IT Pro forums here:

    https://www.techrepublic.com/forums/

    https://www.spiceworks.com/

    I hope it helps.

    Was this answer helpful?

    0 comments No comments