Group Policy stuck in checked out status, cannot be edited because there is no longer a working copy
说明
A group policy is in checked out state where the working copy in AD was accidentally deleted. The group policy can no longer be edited. Eventlog: Error reading data from working copy. There is no such object on the server. (Exception from HRESULT: 0x80072030)
解决办法
In case where the working copy has been accidentally deleted, running the following SQL command in SSMS puts the GPO back into an Available state where we are able to checked it out again.
SQL Command UPDATE dbo.ObjectData SET [StatusID] = 1, [SubStatusID] = 0, [TrusteeSID] = null WHERE VersionControlID = '[VCID]'
In some cases you might not be able even to open the properties of the GPO to find out the Version Control ID VCID
You can find it out via PowerShell or SQL script against the SQL database
Powershell
Open PowerShell on the GPOADmin service host.
Type the following (adjust install path as necessary) to load the provider: Import-Module 'C:\Program Files\Quest\GPOADmin\GPOADmin.psd1'
Type the following to mount the Version Control Root: CD VCRoot:
Treat the Version Control containers as directories and CD into the parent container for the GPO in question.
Type the following to list the properties: Get-Item "GPO_NAME" | Get-Properties Where GPO_NAME is the name of the GPO. Make sure it is in quotes if there is a space in the GPO name.
The property to look for is VCId
If that fails, we can also find it in SQL
SELECT Name, VersionControlID FROM dbo.ObjectData WHERE Type = 2 AND Name = 'GPO_NAME'