$Group is an object, but you will actually need to check if $Group.samaccountname.StartsWith("string").
$Group
$Group.samaccountname.StartsWith("string")
Change $Group.StartsWith("S_G_") to $Group.samaccountname.StartsWith("S_G_").
$Group.StartsWith("S_G_")
$Group.samaccountname.StartsWith("S_G_")
2.1m questions
2.1m answers
60 comments
57.0k users