How do I get an error reason from InstallProductKey (SoftwareLicensingService) in PowerShell?
问题 I'm using some PowerShell functions to configure Windows product keys and activation. I get an instance of the SoftwareLicensingService and call InstallProductKey, like this. The trap block with super formatting is extra to help debugging. trap [Exception] { "==================================================" "Trapped: $($Error[0])" "==================================================" "Exception: $($_.Exception)" "--------------------------------------------------" "" break } $service = Get