Preface
I decided to share this tip, as I was developing some application and I needed to test the user blocking by server when someone else logged with the same account on another machine.
At first, I had two machines and I was logging in and out manually, but after a while I wondered if there is a better way for doing it – that's where I found this PowerShelll feature, which is really nice.
All that is shown here can be written in a notepad, simply save it with ps1 extension or run it straight from the PowerShell.
PowerShell Script with POST
#this is the url that you want will send thae request to
$url = "www.this-is-your-url"
#here you can set your POST params
$account = "pavelDurov"
$password = "123456"
$parameters = "accountName=" + $account + "&" + "password="+ $password
#creating the xmlHtpp system object
$http_request = New-Object -ComObject Msxml2.XMLHTTP
$http_request.open('POST', $url, $false)
#Setting required header of the request
$http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
$http_request.setRequestHeader("Content-length", $parameters.length)
#Assigning the params to the request
$http_request.send($parameters)
#printing the request result
echo $http_request.statusText
Similarly You Can Send with GET Method
#this is the url that you want will send thae request to
$url = "https://this-is-your-url.com"
#creating the xmlHtpp system object
$http_request = New-Object -ComObject Msxml2.XMLHTTP
$http_request.open('GET', $url, $true)
#Sending the request
$http_request.send()
#printing the request result
echo $http_request.statusText