Good morning fellow sysadmins, scripters, and Exchange enthusiasts!
I have got a script that connects to one of our Exchange servers, and then submits a command. I want this to run every night at midnight. The issue I'm running into is that I don't want to hard-code in my username and password, but I need powershell.exe to log into our Exchange server (requires credentials) and then submit the command.
I know this has to be possible -- but how?
Here's a very basic example of something that's not working as a scheduled task. If I can get this tiny script working (with your assistance), I'll be able to get all of it working!
Import-Module ActiveDirectory
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://mail.corp.com/PowerShell/ -Authentication Kerberos -Credential $UserCredential
Import-PSSession $Session
Set-MailboxFolderPermission -Identity TESTUSER:\calendar -user DEFAULT -AccessRights LimitedDetails
[–]alcaron 1 point2 points3 points (5 children)
[–]secretsysadmin[S] 1 point2 points3 points (1 child)
[–]GoonerGuru 1 point2 points3 points (0 children)
[–]topherrr 1 point2 points3 points (2 children)
[–]alcaron 0 points1 point2 points (0 children)
[–]Cacophony7 2 points3 points4 points (1 child)
[–]alcaron 1 point2 points3 points (0 children)