Hello all together,
i am starting with powershell universal.
I would like to install and configure the server using powershell.
Installation succeeded, but then i am facing some issues.
Find-Module -Name universal | Install-Module -Scope AllUsers -Force Install-PSUServer -Path d:\PSU -LatestVersion
Is there a way to create an admintoken via powershell?
I need to change the password for Admin User.
Is there a Best Practice Guide, how to configure PSU with code?
Product: PowerShell Universal Version: 1.4.6
We should probably have this in the docs but here is how we do it in our integration tests.
Invoke-RestMethod http://localhost:5000/api/v1/signin -Method Post -Body (@{
Username = "admin"
Password = "admin"
} | ConvertTo-Json) -SessionVariable Session -ContentType "application/json"
$ENV:TestAppToken = (Invoke-RestMethod http://localhost:5000/api/v1/apptoken/grant -Method GET -WebSession $Session).Token
Set-PSUIdentity -Name 'Admin' -ComputerName http://localhost:5000 -AppToken $Env:TestAppToken -Password ("NewPassword" | ConvertTo-SecureString -AsPlainText -Force)Adam Driscoll
PowerShell Expert and Developer at Devolutions
Wow, that was quick…
Thank i will test this.
Seems that this works only with powershell 7.
In 5.1 i get:
Get-PSUIdentity : Could not load file or assembly ‘System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system
cannot find the file specified.
At line:1 char:1
And it seems that the set-PSUidentity isn’t working either:
Set-PSUIdentity: Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.
This should be the right command imo
Connect-PSUServer -ComputerName $psuinstance -AppToken $ENV:TestAppToken Get-PSUIdentity -Name admin | Set-PSUIdentity -Name 'Admin' -Password ($newpass | ConvertTo-SecureString -AsPlainText -Force) type or paste code here