Methodologies for testing code

When you are creating PowerShell Scripts, it is imperative that you test your code along the way. While there are many different development standards which you can follow such as Scrum and Agile, they all have the same premise of "test often". This section will explore recommendations for testing your code as you are developing it so that you can provide more reliable scripts.

Testing the –WhatIf argument

PowerShell offers the ability to test the cmdlet's code without actually running them. This is done by the use of the –WhatIf argument. The –WhatIf argument will simulate the action that the cmdlet will take on a system without actually executing the command itself. This can assist you in determining if you have ...

Get Mastering Windows PowerShell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.