Powershell and calendar permissions
On exchange 2007 I want to give a user A editor rights to another user B calendar. I want to do this in powershell, is this possible to do in powershell and what would be the command
March 30th, 2011 6:57am

GuvN You can use the EWS Managed API to do this. Most likely you will need to use an account with impersonation rights. Here is a good link that gives some good insight into this. http://gsexdev.blogspot.com/2009/04/using-ews-managed-api-with-powershell.html Below is how i used the EWS API to get calendar permissions. May help a bit. There is also a module i found out there called MessageOps-Exchange-Module. One liners to use the API, but I havent used it yet. I had issues setting up the profile for impersonation, but again i didnt dig into it much. function setUpVariables(){ $dllpath = "C:\Program Files\Microsoft\Exchange\Web Services\1.1\Microsoft.Exchange.WebServices.dll" [void][Reflection.Assembly]::LoadFile($dllpath) }# end function function get-calperms($userNamePath, $acctName, $acctPwd, $domain){ setUpVariables foreach($userEmail in (get-content -Path $userNamePath)){ $service = new-object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2007_SP1) $service.credentials = New-Object System.Net.NetworkCredential($acctName,$acctPwd,$domain) $service.ImpersonatedUserId = New-Object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId("SmtpAddress", $userEmail) $uri=[system.URI] "https://<server.domian>/ews/Exchange.asmx" $service.Url = $uri $cal=[Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar) $perms = $cal.permissions for ($i=0;$i -le ($perms.Count - 1);$i++) { if ($perms[$i].UserId.DisplayName -eq $null) {$user=$perms[$i].UserId.StandardUser} Else {$user=$perms[$i].UserId.DisplayName} [string]$User = $user [string]$CanCreateItems = $($perms[$i].CanCreateItems) [string]$CanCreateSubFolder = $($perms[$i].CanCreateSubFolders) [string]$IsFolderOwner = $($perms[$i].IsFolderOwner) [string]$IsFolderVisible = $($perms[$i].IsFolderVisible) [string]$IsFolderContact = $($perms[$i].IsFolderContact) [string]$EditItems = $($perms[$i].EditItems) [string]$DeleteItems = $($perms[$i].DeleteItems) [string]$ReadItems = $($perms[$i].ReadItems) [string]$PermissionLevel = $($perms[$i].PermissionLevel) [string]$DisplayPermissionLevel = $($perms[$i].DisplayPermissionLevel) $nobject = New-Object -TypeName PSObject $nobject | Add-Member -MemberType NoteProperty -Name Identity -Value $userEmail $nobject | Add-Member -MemberType NoteProperty -Name User -Value $user $nobject | Add-Member -MemberType NoteProperty -Name CanCreateItems -Value $CanCreateItems $nobject | Add-Member -MemberType NoteProperty -Name CanCreateSubFolder -Value $CanCreateSubFolder $nobject | Add-Member -MemberType NoteProperty -Name IsFolderOwner -Value $IsFolderOwner $nobject | Add-Member -MemberType NoteProperty -Name IsFolderVisible -Value $IsFolderVisible $nobject | Add-Member -MemberType NoteProperty -Name IsFolderContact -Value $IsFolderContact $nobject | Add-Member -MemberType NoteProperty -Name EditItems -Value $EditItems $nobject | Add-Member -MemberType NoteProperty -Name DeleteItems -Value $DeleteItems $nobject | Add-Member -MemberType NoteProperty -Name ReadItems -Value $ReadItems $nobject | Add-Member -MemberType NoteProperty -Name PermissionLevel -Value $PermissionLevel $nobject | Add-Member -MemberType NoteProperty -Name DisplayPermissionLevel -Value $DisplayPermissionLevel $nobject }#end for }#end foreach }#end function
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2011 9:30am

You cant directly with PS in 2007. In 2010 you can. With 2007 you have to use EWS code or resort to using alternative tools like pfdavadmin.James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
March 30th, 2011 12:18pm

Hi You can’t do it in powershell in exchange 2010. mviton has posted EWS APi code. Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2011 10:33pm

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

Other recent topics Other recent topics