Connect to Exchange powershell remotely using the following commands
$exchSession=New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $exchUri -Authentication Kerberos -Credential $exchCred
$exchCred is the credentials used to connect
$exchUri is the Uri of the Exchange server powershell virtual directory. EG: http://exchange.anonit.net/powershell
To remove the session at the end, use Remove-PSSession $exchSession
See the powershell script here
I had a server with a system drive low on disk space. Manually clearing the diagnostic log files resolved the issue, but only temporarily. I needed to clear the log files on a schedule until the disk could be expanded. This script was used as a scheduled task.
Small gotcha that caught me recently, I needed to do a test-path but action if a file did NOT exist, and I had trouble getting it to work first go, so I’m writing this here:
## check file exists
if (!(Test-Path $FileToCheck))
throw "$FileToCheck not found"
This will throw the exception if the file can not be found.
I had a bunch of MKV files that I needed to convert to mp4. I don’t have any fancy video editing software, and found that a program called ffmpeg exists, which is a command line tool that will do this. Once I verified that it would do what I wanted, I decided to write a powershell script that will do the work for me, which you can find here.
You will need to download and install ffmpeg and run the script. I have defaulted ffmpeg to “c:\program files\ffmpeg\ffmpeg.exe” as this seems like the logical place for me.
If you have any comments, or ideas on how to improve, please let me know in the comments below.