Answered by:
Get-GPO command renames all GPOs?

-
Hi guys!
Something really weird happened to me yesterday. I was troubleshooting a GPO that was not being accessed by one of the domain controllers (event ID 1058 / 1030 - actually the problem is still on and I will start a discussion about that too because I tried several things and it didin't work, and probably because of this tries that I expirienced the situation I'm about to explain). I used the command Get-GPO in PowerShell. I had used that before and it was pretty OK.
As usual, I never get the syntax right the first time. I wrote something like that:
> Get-GPO -ALL | Where {$_.DisplayName -like '*blablabla*'} | Select id, displayname
> Get-GPO -ALL | Where {$_.id -like '*{I put part of the ID here}*'} | Select id, displayname
I was trying to identify the GPO that appeared in the event 1058. I tried sometimes because I was typing it the wrong way and any results appeared. Then I looked for other GPOs that I new existed, using the same syntax, and any results appeared as well.
For last, I used the command Get-GPO -All | Select id, displayname . All GPOs were displayed, but the DisplayName was the same to all of them. I'm pretty sure the previous Get-GPO commands I gave were the responsible for that, because the DisplayName of all GPOs were renamed to the same string I used in the previous queries (*blablabla*). I started the gpmc, Users and Computers console, and all GPOs were displayed like *blablabla* , including the asterisk
Luckly, I was able to rename them with the correct displayname because the displayname in the GPT.INI file under the GPO folder was not changed.
Do you have any ideas about what may have happened? As I said, all GPOs were renamed with the string I used in the search.
Question
Answers
-
Hi,
Please have a try to query GPO as below and see if the same problem happen again:To get GPO's GUID from name
Get-GPO -name "Group Policy Test" -Properties * | Select displayName,id
To get GPO's name from GUID
Get-GPO -GUID <GPO-GUID> -Properties * | Select displayName,id
Please refer to more details about Get-GPO command from:
Get-GPO
https://technet.microsoft.com/en-us/library/ee461059.aspx?f=255&MSPPError=-2147217396
Group Policy Cmdlets in Windows PowerShell
https://technet.microsoft.com/en-us/library/ee461027.aspx
Best regards,
WendyPlease remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.- Proposed as answer by Wendy JiangMicrosoft contingent staff, Moderator Friday, October 14, 2016 8:29 AM
- Marked as answer by Wendy JiangMicrosoft contingent staff, Moderator Monday, October 17, 2016 8:19 AM
All replies
-
Hi,
Please have a try to query GPO as below and see if the same problem happen again:To get GPO's GUID from name
Get-GPO -name "Group Policy Test" -Properties * | Select displayName,id
To get GPO's name from GUID
Get-GPO -GUID <GPO-GUID> -Properties * | Select displayName,id
Please refer to more details about Get-GPO command from:
Get-GPO
https://technet.microsoft.com/en-us/library/ee461059.aspx?f=255&MSPPError=-2147217396
Group Policy Cmdlets in Windows PowerShell
https://technet.microsoft.com/en-us/library/ee461027.aspx
Best regards,
WendyPlease remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.- Proposed as answer by Wendy JiangMicrosoft contingent staff, Moderator Friday, October 14, 2016 8:29 AM
- Marked as answer by Wendy JiangMicrosoft contingent staff, Moderator Monday, October 17, 2016 8:19 AM
-
-
Hi,
To be honest, the same error is not produced in my lab environment, I have run the script you posted, the correct result is returned, please see the following screenshots:
And based on my knowledge of PowerShell, the syntax you posted is not cmdlet to name GPO, it is just used to retrieve GPO information, strange for your result.
Best regards,
Wendy
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.