I just missed the option -force
New-Item hklm:software/classes/firefoxhtml/shell/edit/command -Force
Using -forcewill also delete everything under the key, if it already exists, so the best option would be
if(!(Test-Path $path)){
New-Item $path -Force;
}
source
share