Power Shell

Hi I want to be able to make life easier and create some power shell scripts so that who ever runs then, it prompts them just to in put, the variables 

eg:  set-MailboxPermission -Identity user1 -User users2 -AccessRight FullAccess -InheritanceType All -Automapping $false

basically i want it to prompt for  to enter user1 and user 2, rather than people amanding eth scripts and then copy and pasting it.
Any Ideas?
I have tried this but it doesn't work

$user = Read-Host "Mailbox That you are giving access to"
$identity = Read-Host "User who wants access"
set-MailboxPermission -Identity $identity -User $user -AccessRight FullAccess -InheritanceType All -Automapping $false

April 16th, 2015 5:49am

$identity = Read-Host "Mailbox That you are giving access to

$user = "Read-Host "User who wants access"

set-MailboxPermission -Identity $identity -User $user -AccessRight FullAccess -InheritanceType All -Automapping $false

This should do,you were giving access the other way

Free Windows Admin Tool Kit Click here and download it now
April 16th, 2015 6:01am

$a = Read-Host -Prompt 'Mailbox Name'

$b = Read-Host -Prompt 'User Name'

Set-MailboxPermission -Identity $a -User $b -AccessRight FullAccess -InheritanceType All -Automapping $false

April 16th, 2015 6:10am

Thanks but when I save that as a powershell file, and then copy the file path in to the Exchange management Console, it doesn't actually run,
it just goes to the next line, to enter a new command?
Free Windows Admin Tool Kit Click here and download it now
April 16th, 2015 8:28am

$a = Read-Host -Prompt 'Mailbox Name'
$b = Read-Host -Prompt 'User Name'
Set-MailboxPermission -Identity $a -User $b -AccessRight FullAccess -InheritanceType All -Automapping $false

save the file as .ps1 and go to the path of the file and run like below

D:\scripts\./test.ps1

April 16th, 2015 11:48am

any update on this?
Free Windows Admin Tool Kit Click here and download it now
April 17th, 2015 2:56am

Hi,

From your description, I would like to clarify that you need to use the following cmdlet to grant one user full access to another's mailbox. Use "Add-MailboxPermission" not "Set-MailboxPermission".

Add-MailboxPermission -Identity "user1" -User user2 -AccessRights FullAccess -InheritanceType All

Hope this can be helpful to you.

Best regards,

April 17th, 2015 2:59am

Thanks, yeah i pasted in the wrong script i am running it as "add"
can can run the script fine from a non exchange serer, with the import module and connect commends ect,
and the script above runs fine from there

however in the EMS Exchange management shell
the script will not run

Free Windows Admin Tool Kit Click here and download it now
April 17th, 2015 5:08am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics