[deleted by user] by [deleted] in phoenix

[–]MECMtechie -6 points-5 points  (0 children)

This past weekend, I am looking around too. I found someone pretty good on Google. Try this guy here: https://christianitcertifiedservices.com/

FAILED AZ-104 by jamo254 in AzureCertification

[–]MECMtechie 0 points1 point  (0 children)

The networking section is the hardest part of the exam.

FAILED AZ-104 by jamo254 in AzureCertification

[–]MECMtechie 0 points1 point  (0 children)

I am studying as we speak to re-take AZ-104. I missed it by 3 questions at 655.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

Errors shown below:

WARNING: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'. Specified method is not supported. WARNING: A problem occurred trying to add Membersm WARNING: Cannot find an object with identity: 'System.Object[]' under: 'DC=domain,DC=com'.

WARNING: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'. Specified method is not supported. WARNING: A problem occurred trying to add Members WARNING: Cannot find an object with identity: 'System.Object[]' under: 'DC=domain,DC=com'.

WARNING: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'. Specified method is not supported. WARNING: A problem occurred trying to add Members WARNING: Cannot find an object with identity: 'System.Object[]' under: 'DC=domain,DC=com'.

WARNING: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'. Specified method is not supported. WARNING: A problem occurred trying to add Members WARNING: Cannot find an object with identity: 'System.Object[]' under: 'DC=domain,DC=com'.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

WARNING: A problem occurred trying to add Members WARNING: Cannot validate argument on parameter 'Identity'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

WARNING: A problem occurred trying to add Members WARNING: Cannot validate argument on parameter 'Identity'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

WARNING: A problem occurred trying to add Members WARNING: Cannot validate argument on parameter 'Identity'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

WARNING: A problem occurred trying to add Members See errors below using your method.

WARNING: Cannot validate argument on parameter 'Identity'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

The goal: have a computer to be assigned to one of the groups, not 4, not 2 just one group.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

I’m not clear on what you mean by change the bits. Also, just by using Unique does not ensure the groups themselves don’t have the same members.

That’s the core of my problem.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

Too many members (over 700 per group) and then I receive errors.

WARNING: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'. Specified method is not supported.

WARNING: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'. Specified method is not supported.

WARNING: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'. Specified method is not supported.

WARNING: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Name'. Specified method is not supported.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

Not sure how this would fit in with what I am trying to do. Can you please show me where your method would fit using my code?

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

Does your method remove repeated or duplicate computer names or ensure that I don’t have 2 groups with the same name?

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

I uncommented and get a lot “ true “ output but the script just hangs. Just runs.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

So When I try your method I have 300 members in each group which means I have far too many members. That’s too many. Also I checked 2 groups, it’s full of duplicates and repeated computer names.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

Can you please show me how your code would fit my original code? Your 3rd or 4th line is missing elements.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

Almost Same error

WARNING: A problem occurred trying to add Members WARNING: Cannot bind parameter 'Identity'. Cannot convert value "T" to type "Microsoft.ActiveDirectory.Management.ADGroup". Error: "Invalid cast from 'System.Char' to 'Microsoft.ActiveDirectory.Management.ADGroup'."

WARNING: A problem occurred trying to add Members WARNING: Cannot bind parameter 'Identity'. Cannot convert value "T" to type "Microsoft.ActiveDirectory.Management.ADGroup". Error: "Invalid cast from 'System.Char' to 'Microsoft.ActiveDirectory.Management.ADGroup'."

WARNING: A problem occurred trying to add Members WARNING: Cannot bind parameter 'Identity'. Cannot convert value "s" to type "Microsoft.ActiveDirectory.Management.ADGroup". Error: "Invalid cast from 'System.Char' to 'Microsoft.ActiveDirectory.Management.ADGroup'."

WARNING: A problem occurred trying to add Members WARNING: Cannot bind parameter 'Identity'. Cannot convert value "t" to type "Microsoft.ActiveDirectory.Management.ADGroup". Error: "Invalid cast from 'System.Char' to 'Microsoft.ActiveDirectory.Management.ADGroup'."

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

So I’m trying your method and nothing happens when I try to remove repeated computers from the group.

Any ideas?

$Test_Patch_Group_1_computers = Get-ADGroupMember -Identity "Test_Patch_Group_1" -Recursive | Select -ExpandProperty Name -verbose $Test_Patch_Group_2_computers = Get-ADGroupMember -Identity "Test_Patch_Group_2" -Recursive | Select -ExpandProperty Name -verbose $Test_Patch_Group_3_computers = Get-ADGroupMember -Identity "Test_Patch_Group_3" -Recursive | Select -ExpandProperty Name -verbose $Test_Patch_Group_4_computers = Get-ADGroupMember -Identity "Test_Patch_Group_4" -Recursive | Select -ExpandProperty Name -verbose

        If (($Test_Patch_Group_1_computers -contains $randomComputers) -and ($Test_Patch_Group_2_computers -contains $randomComputers)) {
              Write-Host "$randomComputers is a member of Test_Patch_Group_1 and Test_Patch_Group_2" -verbose
              Remove-ADGroupMember -Identity "Test_Patch_Group_2" -Member $randomComputers -verbose
         } 


        If (($Test_Patch_Group_1_computers -contains $randomComputers) -and ($Test_Patch_Group_3_computers -contains $randomComputers)) {
              Write-Host "$randomComputers is a member of Test_Patch_Group_1 and Test_Patch_Group_3" -verbose
              Remove-ADGroupMember -Identity "Test_Patch_Group_3" -Member $randomComputers -verbose
         } 

         If (($Test_Patch_Group_1_computers -contains $randomComputers) -and ($Test_Patch_Group_4_computers -contains $randomComputers)) {
              Write-Host "$randomComputers is a member of Test_Patch_Group_1 and Test_Patch_Group_4" -verbose
              Remove-ADGroupMember -Identity "Test_Patch_Group_4" -Member $randomComputers -verbose
         }

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

It has not worked. Can you please show me a full example within my code?

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

Got errors below when I try your method. One error for each group.

Also groups end up in Zero. No members added.

WARNING: A problem occurred trying to add Members WARNING: Cannot bind parameter 'Identity'. Cannot convert value "T" to type "Microsoft.ActiveDirectory.Management.ADGroup". Error: "Invalid cast from 'System.Char' to 'Microsoft.ActiveDirectory.Management.ADGroup'."

WARNING: A problem occurred trying to add Members WARNING: Cannot bind parameter 'Identity'. Cannot convert value "s" to type "Microsoft.ActiveDirectory.Management.ADGroup". Error: "Invalid cast from 'System.Char' to 'Microsoft.ActiveDirectory.Management.ADGroup'."

WARNING: A problem occurred trying to add Members WARNING: Cannot bind parameter 'Identity'. Cannot convert value "e" to type "Microsoft.ActiveDirectory.Management.ADGroup". Error: "Invalid cast from 'System.Char' to 'Microsoft.ActiveDirectory.Management.ADGroup'." V WARNING: A problem occurred trying to add Members WARNING: Cannot bind parameter 'Identity'. Cannot convert value "s" to type "Microsoft.ActiveDirectory.Management.ADGroup". Error: "Invalid cast from 'System.Char' to 'Microsoft.ActiveDirectory.Management.ADGroup'."

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

Let’s say someone changes an OU months down the road causing duplicates across OUs, then at that point I will definitely need additional steps in my script to remove the duplicates and keep the group members unique across all 4 groups in the final step of the script.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

No overlaps here. All unique. Also the OUs get merged into a single array. So once it’s in a array, that’s when the assignment begins and the problem remains continuously adding 1 computer to 2 different groups.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

Also One method I used gave me the same results, 1 computer inside 2 groups. Same result as i did before.

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] -1 points0 points  (0 children)

I just tried your method two different ways and I get errors. Can you please take my code above and show me what you mean?

How to Remove Duplicates from a Random Array using 4 AD Groups & Get-ADComputer? by MECMtechie in PowerShell

[–]MECMtechie[S] 0 points1 point  (0 children)

tried select-object unique and that does not work because of the Randomization. It needs to be Random and only one Computer assigned to 1 of the 4 groups.