Please help understand concept of Pester


Can somebody explain to me how tests work in situation where changes are required to underlying system to be performed?
If my functions do not just add some fictional numbers together to be able to detect if they still performed well after the changes to script but instead say modify files or delete files on remote servers, how do I exactly test those functions.
For example if my script needs to delete files on remote share based on some file pattern. How can I test this sort of scenario by using Pester?


How are you planing to run these scripts that, for example, delete those files?

Pester does create a TestDrive PSDrive for you to use that gets created and destroyed with each pester.

If you need to delete or create files, then this should be a safe place that you can do it without worrying about affecting your systems.

You can use a combination of using a Mock to call to the remote systems and the TestDrive to checking the creation, modifying, or deleting the files.

I’ve linked to the Github documentation so you can check them out and get examples/ideas.


Well somebody looks like thought about this situation and created a testdrive object. How about something more generic like modifying IIS settings or script creating scheduled task?