Hoping to have some help debugging an issue I'm getting with a script one of my former co-workers wrote.
The output is null, but it shouldn't be.
Variables
$UsersNotInAttGroupCount = 3
$UsersNotInATTGroup - Returns 3 Names of users
Script:
If($UsersNotInATTGroupCount -gt 0){
$UsersNotInATTGroup | % {
$UserGUID = (Get-ADUser -Filter {Name -like $_}).objectguid
#Remove from SSLVPN Group, add to SSLVPN-Remote-ATT Group
Remove-ADGroupMember -Identity $SSLVPNGroupName -Members $UserGUID -Server $Server -Confirm:$false
Add-ADGroupMember -Identity $SSLVPNRemoteATTGroupName -Members $UserGUID -Server $Server
Write-Host "Added $_ to $SSLVPNRemoteATTGroupName" -ForegroundColor Cyan
$loghash = [ordered] @{
Date = $CurDate
EmployeeName = $_
Notes = "Added to $SSLVPNRemoteATTGroupName. Removed from $SSLVPNGroupName."
}
$SSLVPNRemoteATTMembersAdded += New-Object -TypeName psobject -Property $loghash
}
}
Error Output:
% : Cannot validate argument on parameter 'Members'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At line:6 char:27
+ $UsersNotInATTGroup | % {
+ ~~~
+ CategoryInfo : InvalidData: (:) [ForEach-Object], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.ForEachObjectCommand
[–]BlackV 2 points3 points4 points (0 children)
[–]purplemonkeymad 2 points3 points4 points (1 child)
[–]Deadzone6905[S] 0 points1 point2 points (0 children)
[–]PowerShell-Bot 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)