1

I'm trying to write a PS script to make it easier to find accounts by simply adding in the Identity of the user.

The idea is to allow other S4B admins to grant recording policy for users with a basic powershell script. SOme of our admins don't know anything about PS and i'm must learning myself.

I have this code that I use - Get-csuser -Identity "email here" |Grant-CsConferencingPolicy -PolicyName "AllowRecording"

What i'm looking to do, but have yet to find in my google searching, is a way to prompt for the Identity. So the other admins will run the script, a prompt in PS will say something like Email address of User: They'll add the email, hit enter, and the policy will be granted by the script.

That's where i'm stuck. How do i get the prompt, and get that input added into the script to grant the policy?

asked Aug 16, 2017 at 22:36

1 Answer 1

1

Try the following:

$UserEmail = Read-Host -Prompt 'Input the user email'
Grant-CsConferencingPolicy -identity $UserEmail -PolicyName "AllowRecording"

Explanation:

  1. Read host will perform a prompt, the information entered here is saved in the UsersEmail variable (see here for more info's)
  2. The users email variable is then used to grant the policy to the user (see here for more info's)
answered Aug 17, 2017 at 7:07
Sign up to request clarification or add additional context in comments.

1 Comment

Perfect! that's what i was looking for.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.