Answer the question
In order to leave comments, you need to log in
How to handle exceptions on Invoke-WebRequest to get Http StatusCode?
When called
Invoke-WebRequest localhosta normal response will return, which will contain the StatusCode of interest to me.
StatusCode : 200
StatusDescription : OK
Invoke-WebRequest : ������ ��������
401 - ������ ��������. ������������ ���������������� ������ ������.
��������������� ������ ������ �� ���� ����� �� �������� � ���� �������� ���� ��������.
string:1 character:1
+ Invoke-WebRequest 192.168.3.5:10000
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question