I am trying to make a quick script to add a AD group to a newly created Local server :
$ServerName = Read-Host 'New Server name?'
$ServerName|Foreach{
$GroupName = -join(“$_”,”-Admins”)
Write-Host $GroupName
Invoke-Command -computername $ServerName -scriptblock {Add-LocalGroupMember -Group 'Administrators' -
Member $GroupName }
}
But I get the Cannot validate argument on parameter 'Member'. The argument is null or empty. Any suggestions? I have tried it several different ways and no joy.