Try this:
Function DeleteAdminGroup{
param(
[string]$strSubComputerName
)
$GroupName = "CN=DEL-GCL-{0}-Admin" -f $strSubComputerName
Try{
Remove-ADGroup -Identity $GroupName -SearchBase $strW10AdminOU -ErrorAction STOP
Out-File $Log -InputObject "SUCCESS: Deleted computer admin group $GroupName from AD"
}
Catch{
OutFile $Log "ERROR: Cannot delete $GroupName $_"
}
}
I don't know where the log file name is declared, or where the strW10AdminOU is declared. I'm assuming they somewhere in the script outside the function.