Share via

command powershell 5.1

DAN NABET 1 Reputation point
2022-01-27T21:31:57.123+00:00

hi,

I can't delete a gpo with powershell in version 5.1 on my 2019 server

on the previous version the command get-removegpo worked there on the new version impossible a lot of get-*** disappeared

Thank's for help

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Server | User experience | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. Limitless Technology 40,106 Reputation points
    2022-01-28T20:24:49.503+00:00

    Hello @DAN NABET

    It is indeed strange, and the fact is that you should be able to edit those policies as administrator. I wouldn't discard that there are other management and administration issue on this computer, so in case of a enterprise environment you may want to look into saving user data and reimaging.

    In your case, the only workaround I can think of is to reset all Local Policies using an elevated command prompt and run:

    RD /S /Q "%WinDir%\System32\GroupPolicyUsers" && RD /S /Q "%WinDir%\System32\GroupPolicy"

    then run a gpupdate /force to load the domain GPOs

    If you get any access denied error or 0x5 that would mean that your user has not enough privileges to manage local policies.

    Hope this helps with your query,

    --------------

    --If the reply is helpful, please Upvote and Accept as answer--

    Was this answer helpful?

    0 comments No comments

  2. Andreas Baumgarten 132.1K Reputation points MVP Volunteer Moderator
    2022-01-27T21:41:54.367+00:00

    Hi @DAN NABET ,

    please try Remove-GPO which is part of the GroupPolicy PowerShell module: https://learn.microsoft.com/en-us/powershell/module/grouppolicy/remove-gpo?view=windowsserver2022-ps

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.