Tags » PowerShell

Removing Databases from Availability Groups with Powershell

Those days at work I had to remove a bunch of databases from the Availability Groups and later drop them from the primary and secondary replicas. 139 more words

VirtualPass

PowerShell: Try/Catch does not work in version 5 with Exchange/Azure PS functions

Here is what I am doing

try{

Get-Mailbox -Identity ed@contoso.com -erroraction stop

Write-host “User exists”

}catch{

Write-host “User does not exist”

Continue

}

It works fine in PS 2,3,4 until I get to PS 5 where the erroraction will not work. 81 more words

PowerShell

Dealing with Runspacepool Variable Scope Creep in PowerShell

Something that I had noticed a while back that I would receive some output values in my objects that shouldn’t have been there. Properties that should have been Null had values in them, and not just random values, but values that matched some of the other outputted objects. 983 more words

Powershell

Quick One-Liner - Search in Files

Today’s one liner is all about how to search file contents in Powershell, recursively.  Bring on the code!

Get-ChildItem -recurse -filter *.cs | Select-String -pattern “SqlConnection” | group path | sort count | select name > sqlconnection.txt… 94 more words

PowerShell

Report Email Traffic By The Hour

It’s a well known fact that reporting is the sexiest topic in IT. To that end, I thought I’d post a quick one liner about email flow reporting in your organisation. 189 more words

Office 365

Synchronize Files and Folders using Powershell

Hello everyone!

Last week I was helping an Application Admin to Synchronize files and folders between Source and Destination Servers. The challenge was because some folders had really long hierarchies, so you could imagine something like this. 134 more words

VirtualPass

Rename & join a computer into a domain within a single powershell command

This command renames the local computer to and then restarts automatically.

In my Test environment the command would be  alike:

Rename-Computer -NewName “w2016DC2” -DomainCredential test.test\administrator -Restart… 97 more words

Active Directory