troubleshooting Question

Modify Powershell script to pause after reading each email

Avatar of E=mc2
E=mc2 asked on
Scripting LanguagesPowershell
2 Comments1 Solution28 ViewsLast Modified:
I would like to modify this part of a Powershell script so that when it looks through any new emails, that it separates each email with
a line so that it is distinguishable..
or that it pauses and asks the user if they want to continue checking..   (to pause after each email)



# Do/while loop for paging through the folder
do
{
    # Set what we want to retrieve from the folder. This will grab the first $pagesize emails
    $view = New-Object Microsoft.Exchange.WebServices.Data.ItemView($numOfEmailsToRead,$index)
    # Retrieve the data from the folder
    $findResults = $service.FindItems([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox,$view)
    foreach ($item in $findResults.Items)
    {
        # load the additional properties for the item
        $item.Load($propertySet)

        # Output the results
        "From: $($item.From.Name)"
        "Subject: $($item.Subject)"
     
    }
    # Increment $index to next block of emails
    $index += $numOfEmailsToRead
} while ($findResults.MoreAvailable) # Do/While there are more emails to retrieve
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros