I can't seem to figure out why if I run the script in Jenkins (local machine), then I get the
The Windows PowerShell snap-in 'Microsoft.SharePoint.PowerShell' is not installed on this machine.
But if I run it outside Jenkins (i.e., running powershell from start menu), then it's fine. I looked at the GAC and the .dll is there.