Category: PowerShell

cmdlet: Remove-InboxRule

Q: Is there a way to remove an Inbox rule for a mailbox? A: Yes. You can use the Remove-InboxRule cmdlet to remove an Inbox rule from a mailbox. Inbox rules process messages in an Inbox based on conditions specified and take actions. Removing an Inbox Rule can assist in troubleshooting end user’s mailboxes. Remove-InboxRule -Mailbox

cmdlet: Enable-InboxRule

Q: Is there a way to enable an Inbox rule for a mailbox? A: Yes. You can use the Enable-InboxRule cmdlet to enable an Inbox rule. Inbox rules process messages in an Inbox based on conditions specified and take actions. The enable/disable InboxRule cmdelts, assist in troubleshooting end user’s mailboxes. Enable-InboxRule “Move To Junk Mail” -Mailbox

cmdlet: Disable-InboxRule

Q: Is there a way to disable an Inbox rule for a mailbox? A: Yes. You can use the Disable-InboxRule cmdlet to enable an Inbox rule. Inbox rules process messages in an Inbox based on conditions specified and take actions. The enable/disable InboxRule cmdelts, assist in troubleshooting end user’s mailboxes. Disable-InboxRule -Identity “MoveAnnouncements“ -Mailbox “Joe@Contoso.com” This example

cmdlet: Set-InboxRule

Q: Is there a way to change or set an Inbox rule on an end user’s mailbox? A: Yes. The Set-InboxRule cmdlet allows you to modify, enable, disable, or even create a rule with this cmdlet. Other than the Get-InboxRule cmdlet, one could argue, the Set-InboxRule is the only other cmdlet you need to know

cmdlet: New-InboxRule

Q: Is there a way to create a new Inbox rule for a mailbox? A: Yes. The New-InboxRule cmdlet creates an Inbox rule to process messages and perform tasks for an Exchange mailbox. This cmdlet works both for on premises and online versions of Exchange. Actions can be taken such as move, copy, or even

Protect OU’s from accidental deletion

Here is a quick and easy one line PowerShell script to set all of the Organizational Units (OU’s) in your Active Directory (AD) to protect from accidental deletion. I know others have posted similar information, but it never hurts to raise awareness of this setting. And also, since I run into many customers that do

cmdlet: Get-InboxRule

Q: Is there a way to get a list of Inbox rules from a mailbox? A: Yes. The Get-InboxRule is available both on premises and online versions of Exchange. This cmdlet allows you to review all or specific Inbox rules on an end user’s mailbox. Get-InboxRule -Mailbox Joe@Contoso.com This example retrieves all Inbox rules for the

Halloween scary PowerShell

Ok, so not sure if it’s all that scary, but interesting what you can do from a security audit stand point. If you Get-Member of a file, you’ll notice something interesting: You can ‘set’ the ‘Last Access Time’ of a file! That can seem scary, especially if do an audit on someone’s last accessed file

Opening multiple files in ISE

Q: Is there a way to open a bunch of files in ISE quickly? A: Yes. Get-ChildItem -Path C:\MyWork -Filter My*.ps1 | ForEach-Object {ise $_.FullName} In this case, any files that start with ‘My’, under the ‘c:\MyWork’ folder, will run through the foreach-object loop and open those files. You can change the path or change the filter options to

PowerShell: Invoke-RestMethod vs Invoke-WebRequest

Was talking with some engineers the other day and the question came up of the differences between Invoke-RestMethod vs Invoke-WebRequest and which cmdlet to use when. Some detailed information from Billy York, but the short answer is: REST for well-formed objects, WebRequest for html. Specifically Rest-Method is intended for REST endpoints (JSON, XLM, etc.) and can