Category: PowerShell

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

FieldNote: Secure password in file?

Sometimes you must store a password for an account in a PowerShell script file. One option is to leverage the ConvertTo-SecureStringcmdlet. By running this cmdlet on a machine, with a specific password, a secure string is generated. You put that value into your file, and then you can run a ConvertFrom-SecureSting to run the script securely. However, I