PS: Install-Module: User declined to install untrusted module (VSSetup).

zosrothko's Avatar


15 Jul, 2017 07:22 AM


I need to install the VisualStudio VSSetup PowerShell module, but installation is rejected because VSSetup is untrusted. How can I get this VSSetup module in the PS module path?

Install-Module VSSetup -Scope CurrentUser
$vs150comntools = Get-VSSetupInstance | Select-VSSetupInstance -Latest -Require Microsoft.VisualStudio.Component.VC.Tools.x86.x64 | select InstallationPath
set-item -force -path "ENV:VS150COMNTOOLS"  -value "vs150comntools"
Write-Host "`nVS150COMNTOOLS=$vs150comntools" -ForegroundColor Yellow
User declined to install untrusted module (VSSetup).
Get-VSSetupInstance : The term 'Get-VSSetupInstance' 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:2 char:19
+ $vs150comntools = Get-VSSetupInstance | Select-VSSetupInstance -Lates ...
+                   ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-VSSetupInstance:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
  1. Support Staff 1 Posted by Ilya Finkelshte... on 16 Jul, 2017 02:16 AM

    Ilya Finkelshteyn's Avatar

    Add the -Force switch. e.g. Install-Module VSSetup -Scope CurrentUser -Force.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac