Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import-GptWmiFilter does not handle null/empty attributes #7

Open
Clebam opened this issue Jan 18, 2022 · 0 comments
Open

Import-GptWmiFilter does not handle null/empty attributes #7

Clebam opened this issue Jan 18, 2022 · 0 comments

Comments

@Clebam
Copy link

Clebam commented Jan 18, 2022

Hi Friedrich,

another awesome tool you have there 👍

I have had a small issue resulting in an error

New-ADObject : The server is unwilling to process the request
At C:\Program Files\WindowsPowerShell\Modules\gpotools\0.3.0\GPOTools.psm1:2586 char:13
+                 $null = New-ADObject @paramNewADObject

I tracked the issue down to the msWMI-Parm1 being empty from my export.

If I enforce some string value, it runs without any issue

$attributes = @{
					"showInAdvancedViewOnly" = "TRUE"
					"msWMI-Name"			 = $wmiFilter.Name
					"msWMI-Parm1"		     = "some description"
					"msWMI-Parm2"		     = $wmiFilter.Filter
					"msWMI-Author"		     = $wmiFilter.Author
					"msWMI-ID"			     = $wmiGuid
					"instanceType"		     = 4
					"distinguishedname"	     = "CN=$wmiGuid,CN=SOM,CN=WMIPolicy,CN=System,$namingContext"
					"msWMI-ChangeDate"	     = $creationDate
					"msWMI-CreationDate"	 = $creationDate
				}

I'm a bit short of ideas on how to handle this.

I think some values are always defined, like the guid, but some like description may actually be null.

For those that can be null, maybe on the export side handle this with predefined values. (Say the name of the GPO for instance)

Hopefully this helps a bit 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant