PSOMWebproxy.psm1
|
Import-Module –Name "PSOM" function get-PSOMWebproxy ( [bool] $useHTTPS, [String] $OMWebserver, [String] $configname ="default", $debuginfo = 0, [System.Management.Automation.PSCredential]$Credential ) { $setting = get-PSOMSetting -configname $configname -debuginfo $debuginfo if (!$useHTTPS){ $useHTTPS = $setting.useHTTPS } if (!$OMWebserver){ $OMWebserver = $setting.OMWebserver } #debug info if ($debuginfo -gt 0 ) { Write-Host "Starting Request using:" Write-Host "debuginfo: " $debuginfo Write-Host "useHTTPS: " $useHTTPS Write-Host "OMWebserver: " $OMWebserver } [xml]$SOAPRequest = $SOAPRequest #Input if ($useHTTPS) { [String] $URL = "https://"+$OMWebserver+"/omwebservice/omwebservice.asmx" if ($debuginfo -gt 0 ) { Write-Host "Using https true" Write-Host "Using URL: " $URL } } else { [String] $URL = "http://"+$OMWebserver+"/omwebservice/omwebservice.asmx" if ($debuginfo -gt 0 ) { Write-Host "Using https true" Write-Host "Using URL: " $URL } } if ($Credential) { $omproxy = "" $omproxy = New-WebServiceProxy -Uri $URL -UseDefaultCredential $omproxy.Credentials = $Credential return $omproxy } else { return New-WebServiceProxy -Uri $URL -UseDefaultCredential } } Export-ModuleMember -Function get-PSOMWebproxy |