$APS = $APE.CreatePolicySetting()
$APS.Name = 83
$APS.Value = "$GroupGUID"
$APE.AddPolicySetting($APS)
How can I add multiple GUIDS here.
$APS = $APE.CreatePolicySetting()
$APS.Name = 83
$APS.Value = "$GroupGUID"
$APE.AddPolicySetting($APS)
How can I add multiple GUIDS here.
Hi amitsingh
Have you tried adding an array of GUIDs to the Values (not value) property?
IE, in my case add all groups where the samAccountName start with Test
$GroupGUIDs = (Get-QADGroup -LdapFilter "(&(objectCLass=group)(samAccountName=test*))").guid.guid
$APS = $APE.CreatePolicySetting()
$APS.Name = $EDS_APE_PARAM_GRPGUIDs
$APS.Values = $GroupGUIDs
$APE.AddPolicySetting($APS)
May I know the value for $EDS_APE_PARAM_GRPGUIDs variable
Hi Stu, when I have tried an array, the error returned is "Unable to case object of type System.Object[] to type System.String".
I have also tried a ForEach loop but this doesn't result in multiple '83' entries ($APS.Name = 83) being added to the policy, it seems to just continue overriding the single entry until the last GUID is processed, resulting in only one '83' entry.
Hi Stu, when I have tried an array, the error returned is "Unable to case object of type System.Object[] to type System.String".
I have also tried a ForEach loop but this doesn't result in multiple '83' entries ($APS.Name = 83) being added to the policy, it seems to just continue overriding the single entry until the last GUID is processed, resulting in only one '83' entry.
Same happens in my case also but when I tried it directly it works:
$APS = $APE.CreatePolicySetting()
$APS.Name = 83
$APS.Values = "1stGUID","2ndGUID"
$APE.AddPolicySetting($APS)
I tried pitting it as a string but that also failed.
$GroupID = "1stGUID","2ndGUID"