There are some rules regarding which functions can be used in in Chocolatey packages hosted on the community repository. Basically, any function not available in PowerShell v2.0 can not be used (without a fallback helper). In this gist I want to keep a list of functions that were not available in PowerShell 2.0, or I have found that did not work as expected.
Convert-FromJson
- while it is a common function nowadays, this was only added in PowerShell 3.0 and can not be used in a community package.Get-ItemPropertyValue
- added in PowerShell 5.0, and do not exist on the Chocolatey verifier.Import-Certificate
- Only available on some Server platforms (and Windows 10). As an alternative the linked fallback helper can be used instead
Mount-DiskImage
andDismount-DiskImage
are not PowerShell v2 compatible, and they also require Windows 8/server 2012 or newer.See https://chocolatey.org/packages/chocolatey-isomount.extension
Add-WindowsDriver
is also Windows 8+, and PowerShell v3+, generally it is possible to usepnputil.exe
as an alternative.Same for most (or all?) of the other DISM functions: https://docs.microsoft.com/en-us/powershell/module/dism/?view=winserver2012-ps
This is not PowerShell exactly, but on Windows 7 (maybe 8 as well), but if you using
pnputil
, the newer/add-driver
and/install
flags are not available, so instead use-a
and-i
, which do exist on Windows 7.