Tag: PowerShell

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

cmdlet: Remove-DistributionGroupMember

Q: Is there a way to remove a user from a distribution group? A: Yes, there is the built in Remove-DistributionGroupMember cmdlet available, both for an on premises Exchange Server environment and Exchange online tenants. Remove-DistributionGroupMember -Identity GroupName -Member UserName  

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

cmdlet: Add-DistributionGroupMember

Q: Is there a way to add users to a distribution group? A: Yes, there is the built in Add-DistributionGroupMember cmdlet available, both for an on premises Exchange Server environment and Exchange online tenants. Add-DistributionGroupMember -Identity GroupName -Member UserName  

cmdlet: Get-DistributionGroupMember

Q: Is there a way to list or get members in a distribution group? A: Yes, there is the built in Get-DistributionGroupMember cmdlet available, both for an on premises Exchange Server environment and Exchange online tenants. Get-DistributionGroupMember -Identity GroupName -Member UserName  

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