Powershell Trick: Execute Logon Script as per Group Membership
Posted by Brajesh Panda on May 22, 2016
If((Get-ADPrincipalGroupMembership $env:username).name -like “Domain Users”)
Change the Write-Host section with the action script, what you want to execute. I think this is what you want.
Here $env:username gets the logged on user name. It is like “whoami” command, without the domain info. You can get domain info using $env:USERDNSDOMAIN