Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Connect-WSP
- {
- param(
- [parameter(Mandatory=$true)]
- [string]$Username,
- [parameter(Mandatory=$true)]
- [string]$Password,
- [parameter(Mandatory=$true)]
- [string]$Server,
- [parameter(Mandatory=$false)]
- [int]$Port = '9002',
- [parameter(Mandatory=$true)]
- [string]$Endpoint
- )
- $Secpasswd = ConvertTo-SecureString $Password -AsPlainText -Force
- $Credential = New-Object System.Management.Automation.PSCredential($Username, $Secpasswd)
- $Proxy = New-WebServiceProxy -Uri "http://$Server`:$Port/$Endpoint" -Credential $Credential
- return $Proxy
- }
- $Wsp = Connect-WSP -Username serveradmin -Password MyS3cureP@ssword -Server myServer.com -Endpoint esUsers.asmx
- $Wsp.GetUserById(2)
Advertisement
Add Comment
Please, Sign In to add comment