#Verify that the partner is running. If not, strat it. if((Get-Process -Name ImEXOnlinePartner -ErrorAction SilentlyContinue) -eq $null){ & "$Env:USERPROFILE\AppData\Local\ImEXOnlinePartner\ImEXOnlinePartner.exe" } $PSversion = $PSVersionTable.PSVersion.Major function v2 { # Post request to the partner to trigger the export. Invoke-WebRequest -Uri http://localhost:1337/paintscale/export/ -Method POST } function v1 { WebRequest = [System.Net.WebRequest]::Create("http://localhost:1337/paintscale/export/") WebRequest.Method = "POST" WebRequest.ContentType = "application/json" Response = $WebRequest.GetResponse() ResponseStream = $Response.GetResponseStream() ReadStream = New-Object System.IO.StreamReader $ResponseStream #Data=$ReadStream.ReadToEnd() } Switch ($PSversion) { 1 {v1} 2 {v1} 4 {v2} 5 {v2} 6 {v2} 7 {v2} }