Skip to content

Adds PSU Install Option to Environment#313

Open
JPRuskin wants to merge 2 commits into
chocolatey:mainfrom
JPRuskin:psu
Open

Adds PSU Install Option to Environment#313
JPRuskin wants to merge 2 commits into
chocolatey:mainfrom
JPRuskin:psu

Conversation

@JPRuskin

Copy link
Copy Markdown
Member

Description Of Changes

Adds Start-C4bPsuSetup.ps1 to the install scripts available in the root of the repository.

Motivation and Context

We have a lot of excellent ideas that we can implement by helping customers utilize PowerShell Universal. We need to have a method for installing everything in that case.

Testing

  1. Download repository
  2. Comment out Jenkins install in initialize script
  3. Run through init script
  4. Manually trigger Start-C4bPsuSetup.ps1 with any args (e.g. thumbprint)

Operating Systems Testing

  • Windows 2022

Change Types Made

  • [ ] Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • [ ] Breaking change (fix or feature that could cause existing functionality to change).
  • [ ] Documentation changes.
  • PowerShell code changes.

Change Checklist

  • [ ] Requires a change to the documentation.
  • [ ] Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • [ ] PowerShell code changes: PowerShell v3 compatibility checked?
  • [ ] All items are complete on the Definition of Done.

@JPRuskin JPRuskin requested a review from ryanrichter94 March 31, 2026 15:05
Comment thread Start-C4bPsuSetup.ps1
$ErrorActionPreference = 'Stop'
Start-Transcript -Path "$env:SystemDrive\choco-setup\logs\Start-C4bPsuSetup-$(Get-Date -Format 'yyyyMMdd-HHmmss').txt"

Invoke-Choco upgrade powershelluniversal-remove-default-listener.hook --confirm --no-progress

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it ran before PowerShell Universal is installed? What listener is it removing?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a hook package, so (unless written to run on install as well as a hook) it needs to be in place before the main package is installed. Though thinking about it, this one is fine to move to after, we're making the adjustment in the setup script... so I can move it to after. Easy!

The listener it's removing is the http :5000 from one of the multiple configuration files, so that we can use it ourselves (and so that we don't have an additional http listener that we don't want to have available).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this stays as a package, it will need to be added to the chocolatey.json file for the packages used by the guide.

@steviecoaster steviecoaster May 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a package? This seems to be an unnecessarily complex way to solve this. I strongly suggest we look to do this as part of installing PSU in the setup script, and avoid making yet another package.

Comment thread Start-C4bPsuSetup.ps1
Comment thread Start-C4bPsuSetup.ps1
Comment thread Start-C4bPsuSetup.ps1
Comment thread Start-C4bPsuSetup.ps1
Comment thread Start-C4bPsuSetup.ps1 Outdated
This should help us maintain consistency across the codebase.
@JPRuskin JPRuskin force-pushed the psu branch 2 times, most recently from 3126c79 to 9c58097 Compare May 26, 2026 15:36
Comment thread Start-C4bCcmSetup.ps1 Outdated

@ryanrichter94 ryanrichter94 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internal Error when running PSU setup script.

Comment thread Start-C4bPsuSetup.ps1
$null = New-Item -Path $RepositoryDirectory\.universal\settings.ps1 -Value @'
$Parameters = @{
EnhancedAppTokenSecurity = $true
ApiSecurityModel = $true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start-C4bPsuSetup hung after successfully installing the chocolatey-licensed-psu-environment package. Started digging into logs

Got the following error in this log file C:\ProgramData\PowerShellUniversal\Logs\User

[15:21:33 ERR][Configuration][settings.ps1] Error deserializing C:\ProgramData\UniversalAutomation\Repository\.universal\settings.ps1. Cannot bind parameter 'ApiSecurityModel'. Cannot convert value "True" to type "PowerShellUniversal.ApiSecurityModel". Error: "Invalid cast from 'System.Boolean' to 'PowerShellUniversal.ApiSecurityModel'."

Removed the ApiSecurityModel section from the mentioned settings.ps1 in the error, and restarted the PowerShell Universal Windows Service. Was then presented with the first-run page when browsing to https://hostname:5000, with options to log in via a Devolutions account or perform initial setup.

@ryanrichter94 ryanrichter94 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questions around when we invoke the c4b-enviornment.powershell package install.

Comment thread OfflineInstallPreparation.ps1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants