Functions to Import Skype and Exchange Remote Commandlets

These two functions will check DNS for any MX records and sipinternalTLS DNS records and then attempt to establish a remote powershell connection to those servers. 

Function Import-SkypePSTools{
Write-Host "Loading Skype For Business Module"
$SkypeServer = "https://"+ ((Resolve-DnsName -Name "_sipinternaltls._tcp.$env:USERDNSDOMAIN" -Type SRV).nametarget).tolower()+ "/ocspowershell"
$SkypeSession = New-PSSession -ConnectionUri $SkypeServer -Credential (Get-Credential)
Import-PSSession $SkypeSession

Function Import-ExchangePSTools{
Write-Host "Loading Exchange Module"
$ExchangeServer = "http://"+ ((Resolve-DnsName -Name $env:USERDNSDOMAIN -Type MX).nameexchange).tolower() + "/powershell/"

$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionURI -Authentication Kerberos -Credential (Get-Credential)
Import-PSSession $ExchangeSession


Popular posts from this blog

Application Doesn't Install During OSD Task Sequence in SCCM

SCCM PXE Boot Issues - No Advertisements Found

Outlook VBA Macros for Journal Entries