Hello smart people!
I've been tasked with removing the ability in Office365 for users to record their Skype meetings. I have the PowerShell to make that happen via the ISE console, but when I try to make it into a custom command in Adaxes, it fails.
My team had previously been tasked with inactivating Yammer in Office365, which worked for quite a while until (I think) updating to the latest version of Adaxes. I tried using the "kill yammer" script as a template for my "kill skype recording" script, but I think in both cases, the issue is that something has changed in the way that Adaxes opens sessions to connect to the needed consoles.
Here's my working PowerShell to set the Skype policy to "no recording" via the ISE:
# KILL SKYPE RECORDING - ISE
# Get Credential
$Cred = Get-Credential
try
{
# Connect to LyncOnlineConnector Service
Import-Module LyncOnlineConnector
$lyncSession = New-CsOnlineSession -Credential $Cred
Import-PSSession $lyncSession -AllowClobber
# Set the Conferencing Policy to “No Record”
Grant-CsConferencingPolicy -identity TESTUSERGOESHERE -PolicyName BposSAllModalityNoRec
}
finally
{
# Close the remote session and free up resources
Remove-PSSession $lyncsession
}
Here's the script that USED to work for "kill yammer":
# KILL YAMMER - ADAXES
# Get credentials of the Office 365 tenant associated with the user
$adminName = $Context.RunAs.UserName
$adminPassword = ConvertTo-SecureString -AsPlainText -String $Context.RunAs.Password -Force
$o365Credential = New-Object System.Management.Automation.PsCredential($adminName, $adminPassword)
try
{
# Create a remote PowerShell session to Exchange Online
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell-liveid" -Credential $o365Credential -Authentication Basic -AllowRedirection
Import-PSSession $session -AllowClobber -DisableNameChecking
# Connect to MSOL Service
Import-Module MsOnline
Connect-MsolService -Credential $o365Credential
# Remove Yammer License
Set-MsolUserLicense -UserPrincipalName "%userPrincipalName%" -LicenseOptions (New-MsolLicenseOptions -AccountSkuId "actinc:EnterprisePACK" -disabledplans YAMMER_ENTERPRISE)
Set-MsolUserLicense -UserPrincipalName "%userPrincipalName%" -LicenseOptions (New-MsolLicenseOptions -AccountSkuId "actinc:StandardPACK" -disabledplans YAMMER_ENTERPRISE)
}
finally
{
# Close the remote session and free up resources
Remove-PSSession $session
}
Here's my combination of the two:
# KILL SKYPE RECORDING - ADAXES
# Get credentials of the Office 365 tenant associated with the user
$adminName = $Context.RunAs.UserName
$adminPassword = ConvertTo-SecureString -AsPlainText -String $Context.RunAs.Password -Force
$o365Credential = New-Object System.Management.Automation.PsCredential($adminName, $adminPassword)
try
{
# Connect to LyncOnlineConnector Service
Import-Module LyncOnlineConnector
$lyncSession = New-CsOnlineSession -Credential $o365Credential
Import-PSSession $lyncSession -AllowClobber
# Set the Conferencing Policy to “No Record”
Grant-CsConferencingPolicy -identity "%userPrincipalName%" -PolicyName BposSAllModalityNoRec
}
finally
{
# Close the remote session and free up resources
Remove-PSSession $lyncSession
}
And here's the error it returns, when I run this as a custom command:
- Skype Conferencing - Disable: 1 operation executed
-- Run PowerShell script '-PolicyName BposSAllModalityNoRec' for the user
--- Cannot bind argument to parameter 'String' because it is null.
--- Exception calling ".ctor" with "2" argument(s): "Cannot process argument because the value of argument "userName" is invalid. Change the value of the "userName" argument and run the operation again."
--- The specified module 'LyncOnlineConnector' was not loaded because no valid module file was found in any module directory.
--- Cannot validate argument on parameter 'Id'. The argument is null. Supply a non-null argument and try the command again.
--- The term 'New-CsOnlineSession' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At the end of the day, I just need to have the two scripts, "kill yammer" and "kill skype recording", working. Any assistance in replacing or re-writing would be greatly appreciated!!