I wish to select the thirdline of text from a sting in powershell.
The string I have is coming from the body of an email:
$olFolderInbox = 6
$outlook = new-object -com outlook.application;
$ns = $outlook.GetNameSpace("MAPI");
$inbox = $ns.GetDefaultFolder($olFolderInbox)
foreach ($email in $inbox.items){
if($email.Subject -eq "PASSED") {
$Body = $email.Body
write-host $emailSentOn
write-host $email.Body
}
}
The $Body string is formatted like so:
<BLANK LINE>
Queue Cleared!
Server Name
Username
I wish to exact the Server name from the 4 line text string.
Thanks