I hope this is an easy request but I'm a little limited with my Powershell scripting shells so I've run in to some issues.
What I want to do is create a security group after a I create a new user based on the Company AD field. Ideally I'd like the scrip to check to see if the security group exists, if it doesn't, create the security group and add the user to the group but if the group already exists then just add the user to the existing group. so for example:
Portal creates user1 with the company of company1
Portal creates group company1
Portal adds user1 to the company1 security group
Portal creates user2 with the company of company1
Portal adds user2 to the company1 security group
Here is what I have for my powershell script so far:
New-ADGroup -Name %company% -Path "OU=Customer Security Groups,OU=Groups,OU=CSN,DC=domain,DC=com" -groupScope global
Add-ADGroupMember -Identity %company% -Members %sAMAccountName%
But I get this error:
The term 'New-ADGroup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
The term 'New-ADGroupMember' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Can someone point me in the right direction?
thanks
Jim