Jump to content

Recommended Posts

Posted (edited)

Hello, i am trying to setup a very simple script to install powertoys as we have a need for the image resize feature on some computers. it can be installed using the winget cmdlet in powershell or the windows terminal, i have run it manually on both widows 10 and 11, but running the script the pulseway give be the following

 

$ winget install Microsoft.PowerToys --source winget

winget : The term 'winget' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

+ winget install Microsoft.PowerToys --source winget + ~~~~~~ + CategoryInfo : ObjectNotFound: (winget:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

Edited by Evan Newton
  • Administrators
Posted

Hi Evan,

winget is an msix (Windows Store Component, source) that must run in a per-user sandbox which is not available when running from the machine account (SYSTEM). You could force it to run against the logged in user (if any) through psexec but you'd need to distribute it somehow.

-Paul

Posted
On 5/16/2022 at 2:29 PM, Evan Newton said:

Hello, i am trying to setup a very simple script to install powertoys as we have a need for the image resize feature on some computers. it can be installed using the winget cmdlet in powershell or the windows terminal, i have run it manually on both widows 10 and 11, but running the script the pulseway give be the following

 

$ winget install Microsoft.PowerToys --source winget

winget : The term 'winget' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

+ winget install Microsoft.PowerToys --source winget + ~~~~~~ + CategoryInfo : ObjectNotFound: (winget:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

You can just use the RunAs PowerShell module as well to accomplish this if you don't feel like dealing with psexec and having to distribute the package yourself. 

This works fine for logged in users. It will check if you have the RunAs module installed and if not, install it first.

$ErrorActionPreference = "SilentlyContinue"
 
if (!(Get-InstalledModule | Where-Object { $_.Name -eq "RunAsUser" })) {
    Write-Host "Not Installed. Installing"
    Install-Module RunAsUser -Force
}
 
$ScriptBlock = {
    winget install Microsoft.PowerToys --source winget
}
 
Invoke-ASCurrentUser -ScriptBlock $ScriptBlock
 
Write-Host "Check Device to ensure PowerToys installed successfully."
 
Exit 0
  • 9 months later...
Posted

 Hi, I found that the above solutions failed to work. In the end I talked to Pulseway support and they pointed out the following article where if you can enable and configure the "Enable PowerShell User Impersonation" found under the Pulseway Manager software Settings (tab) -> Runtime (tab).

This is the article that describes it:
https://intercom.help/pulseway/en/articles/1514837-how-to-configure-the-runtime-settings-for-the-pulseway-manager

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...