Scripts/Send-XML.ps1

function Send-XML
{
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true)]
        [string]$Computer,
        [Parameter(Mandatory=$true)]
        [pscredential]$remote_access_creds,
        $XML
    )
$XMLtempPath = ".\SkypeSettings.xml"
$XML > $XMLtempPath
$targetDevice = "C:\Users\Skype\AppData\Local\Packages\Microsoft.SkypeRoomSystem_8wekyb3d8bbwe\LocalState\SkypeSettings.xml"

$session = New-PSSession â€“ComputerName $Computer -credential $remote_access_creds
$session_id = $session.Id

#remove comment on below line when actually running the script
Copy-Item -path $XMLtempPath -Destination $targetDevice â€“ToSession $session

#Verifies if file was copied
$verifycopy = Invoke-Command -ComputerName $Computer -credential $remote_access_creds -ScriptBlock { Get-ChildItem C:\Users\Skype\AppData\Local\Packages\Microsoft.SkypeRoomSystem_8wekyb3d8bbwe\LocalState\ }
$Test = $verifycopy | Select-String -Pattern "SkypeSettings.xml"
    
#If verified - restart Room
if($Test -like "SkypeSettings.xml") {
    
    invoke-command { Shutdown /r /t 0 } -ComputerName $Computer -credential $remote_access_creds
    $Result = @{
        computer = $Computer
        xml_copied = $true
        room_rebooted = $true
    }
} Else { 
    $Result = @{
        computer = $Computer
        xml_copied = $false
        room_rebooted = $false
    }
}
New-Variable -Name return_object -value $Result
$remove_session = Remove-PSSession -Id $Session_id
Remove-Item -Path $XMLtempPath
Return ${return_object}
}