Working with external utilities

Sometimes, PowerShell cmdlets are not enough. Although this rarely is the case nowadays, there are times you may need to resort to external utilities. This is especially valid for PowerShell Core on different operating systems with different sets of binaries.

Consider the following example: you are tasked with creating local users on a set of Windows and Linux machines with the least amount of code. You know that all machines have enabled PowerShell remoting:

# Sample 1 - Creating users on Windows and Linux hosts$windowsMachines = 'WindowsHost1', 'WindowsHost2'$linuxMachines = 'LinuxHost1', 'LinuxHost2'$username = 'localuser1'$password = 'P@ssw0rd' | ConvertTo-SecureString -AsPlainText -Force$newCredential ...

Get Learn PowerShell Core 6.0 now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.