database-tools

Logging All Errors

In a previous tip you have seen that cmdlet errors can only be caught by an error handler if the -ErrorAction is set to "Stop". Doing this...

read more

Logging Script Runtime

If you'd like to monitor how long a script takes to run, you could use Measure-Command, but this cmdlet is for diagnostic purposes only and...

read more

Reading All Text

You can use Get-Content to read in any plain text file. However, Get-Content will return the file content line by line, and you get back a string...

read more

Storing Secret Data

If you wanted to store sensitive data in a way that only you could retrieve it, you can use a funny approach: convert some plain text into a secure...

read more

Testing UNC Paths

Test-Path can test whether or not a given file or folder exists. This works fine for paths that use a drive letter, but can fail with pure UNC...

read more

Enabling Classic Remoting

Many cmdlets have built-in remoting capabilities, for example Get-Service and Get-Process both have the parameter -ComputerName, and so does...

read more

Applying NTFS Access Rules

There are many ways to add or change NTFS permissions. One is to reuse existing tools such as icacls.exe. This function will create new folders that...

read more