
Pretty simple process going on below:
- I store a list of drive letters to be tested into an array (in preference order)
- Then utilize the EMS get-exchangeserver cmdlet to collect a filtered set of all exchange servers (in this case, using get-exchangeserver | where{$_.isHubTransportServer -eq $true} to return only HubTransports anywhere in the Org)
- I then loop the exchange servers list against the drives array, testing for a functional path (which indicates a suitable target drive), and using the {break} command to drop out of the loop at the first matching drive in the list.
- Whereuopon the designated file is copied to the matching UNC path
Copy/Distribute file to every exchange server, with preference order as to which target drive: (1-line below; the command skips tests and copies to the first match)
Here's a Gist with the code:
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.