Recently, I was asked to look at creating a password-protected Zip file via PowerShell using 7-Zip. With one directory as a source, it is relatively straightforward:
xxx
But, because of the size of some files that we were adding to the archive it was decided to leave them in place and directly add them to the archive. 7-Zip allows for this in its command line:
xxx
When running this via command line, the archive was created as expected, but under PowerShell and passing variables, there was no archive created:
xxx
Graph and PowerShell Blog