dakhama-mehdi / Modern_ActiveDirectory

Modern Active Directory
MIT License
62 stars 11 forks source link

Error returned on Get-GPO #4

Closed ylyony closed 1 year ago

ylyony commented 1 year ago

Capture As we shown on the capture, I've an error when I launch Get-AdModernReport How can I track and correct that ?

dakhama-mehdi commented 1 year ago

Hi, It's not really a error, at line 474 with this command :
$LinkedGPOs.Add((Get-GPO -Guid $Split2 -ErrorAction SilentlyContinue).DisplayName)

We try to get a displayname for GPO linked to add it to list, perhaps the split is not corret if your GPO content "{" or the GPO not have a displayname,

You can add a write host : $split2 just above the line on pms1 script on your directory, and run the script, you will see the GPO before error, and try with GUID if the command : "Get-GPO -Guid $Split2 " list some things.

Let me know, if this resolve problem or a picture of GPO name or result, i'm here if any question.

Follow what you need to add on modernactivedirectory.ps1, search this line and add write-host for sample track :

if (!$nogpomod) { write-host this $Split2 $LinkedGPOs.Add((Get-GPO -Guid $Split2 -ErrorAction SilentlyContinue).DisplayName) }

dakhama-mehdi commented 1 year ago

For advance track :

if (!$nogpomod) { $LinkedGPOs.Add((Get-GPO -Guid $Split2 -ErrorAction Stop -Errorvariable GPOTrack).DisplayName) write-host $GPOTrack }