chocolatey-licensed-issues
chocolatey-licensed-issues copied to clipboard
Failing to load PowerShell module on the second try
What You Are Seeing?
When using an Advanced Deployment step in Chocolatey Central Management, installed PowerShell modules throw an error when attempting to load into the PowerShell host after the first time at doing so.
What is Expected?
Advanced Deployment step code is executed on a target machine every time it is needed
How Did You Get This To Happen? (Steps to Reproduce)
To reproduce, run the following deployment against your targets twice
- Import Agent_PowerShell_Host_Test.json into CCM
- Add target Group to advanced step
- Save Deployment
- Move Deployment to ready
- Run deployment
- When deployment is finished, duplicate deployment
- Move duplicated deployment to ready
- Run duplicated deployment
- Examine errors after second attempt
System Details
- Operating System: Server 2019
- Windows PowerShell Version: 5.1
- Chocolatey CLI Version: 2.2.2
- Chocolatey Licensed Extension version: 6.0.1
- Chocolatey License type (Professional / Business / ?): Business
- Terminal/Emulator: Windows PowerShell
- Central Management Version: 0.11.0
- Chocolatey Agent Version: 2.1.0
Output Log
error.log
## 2023-11-27 19:13:27,989 [DEBUG ] -
$hostname = hostname Write-Host "Hostname: $hostname" Import-Module NetSecurity -Force Get-NetFirewallSetting -PolicyStore ActiveStore | Select-Object -ExpandProperty ActiveProfile
## exit $LASTEXITCODE
2023-11-27 19:13:28,035 [INFO ] - Hostname: DemoServer 2023-11-27 19:13:28,035 [VERBOSE] - Loading module from path 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\NetSecurity\NetSecurity.psd1'. 2023-11-27 19:13:28,035 [VERBOSE] - Loading 'TypesToProcess' from path 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\NetSecurity\NetSecurity.types.ps1xml'. 2023-11-27 19:13:28,035 [VERBOSE] - Loading 'FormatsToProcess' from path 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\NetSecurity\NetSecurity.formats.ps1xml'. 2023-11-27 19:13:28,066 [VERBOSE] - Loading module from path 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\NetSecurity\Microsoft.Windows.Firewall.Commands.dll'. 2023-11-27 19:13:28,066 [ERROR ] - Value cannot be null. Parameter name: source at <ScriptBlock>, <No file>: line 3 2023-11-27 19:13:28,066 [DEBUG ] - Chocolatey PowerShell agent exited with '1'. ~~~ </p></details>
## Workarounds
1. Restart the agent service on the failing endpoint(s).
## Proposed Solution
## Related Issues and Tickets
* [Zendesk Ticket](https://chocolatey.zendesk.com/agent/tickets/20477)
* [Zendesk Ticket](https://chocolatey.zendesk.com/agent/tickets/20212)
* [Zendesk Ticket](https://chocolatey.zendesk.com/agent/tickets/20126)
* [ZenDesk Ticket](https://chocolatey.zendesk.com/agent/tickets/21486)
* [ZenDesk Ticket](https://chocolatey.zendesk.com/agent/tickets/23304)
## Done Checklist
TBD
┆Issue is synchronized with this [Gitlab issue](https://gitlab.com/chocolatey/collaborators/choco-licensed-services/-/issues/111) by [Unito](https://www.unito.io)