Forum Discussion
SteveCox
Oct 11, 2021Brass Contributor
Automation of Exchange server Patching
Hi I am trying to setup a Script to automate patching of Exchange 2016 servers and I need to get the script to check if any if the other exchange server is in Maintenance Mode before continuing to pl...
Oct 11, 2021
Have to boot up my Exchange lab to check, however, be careful while assigning Format-List output to a variable, that should be used only to output to screen.
So it would be better to:
$cluster = Get-ClusterNode -Name Exchange1
If ($cluster.state -eq "Up") { Write-Host "Cluster is Up"}
So it would be better to:
$cluster = Get-ClusterNode -Name Exchange1
If ($cluster.state -eq "Up") { Write-Host "Cluster is Up"}
SteveCox
Oct 12, 2021Brass Contributor
Thanks yes this work thanks for the pointer on the Format-List assignment, Once I have a working version of this completed I will post it here
- Oct 12, 2021Great Steve!
- SteveCoxNov 05, 2021Brass ContributorJust got one more question and then I can complete this bit of work and post it here. I need to get the last modified date from an Invoke-WebRequest
$response = Invoke-WebRequest -uri http://xxxxxxx
and if I look at $response I get the following output
"PS C:\Windows\system32> $response1
StatusCode : 200
StatusDescription : OK
Content : ÿþ< ! D O C T Y P E h t m l P U B L I C
" - / / W 3 C / / D T D X H T M L 1 . 0
S t r i c t / / E N " " h t t p : / / w w w . w 3 . o r g / T
R / x h t m l 1 / D T D / x h t m l 1 - s ...
RawContent : HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 2414
Content-Type: text/html
Date: Thu, 04 Nov 2021 16:55:02 GMT
ETag: "40fb6e89bd1d71:0"
Last-Modified: Thu, 04 Nov 2021 16:49:17 GMT
Serve...
Forms : {}
Headers : {[Accept-Ranges, bytes], [Content-Length, 2414], [Content-Type,
text/html], [Date, Thu, 04 Nov 2021 16:55:02 GMT]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : System.__ComObject
RawContentLength : 2414"
What I need is to get the Last-Modified date and check that this is todays date but cannot find a way to do this?- Nov 05, 2021