0

I'm trying to install this module "VPNCredentialsHelper", but I get the following prompt even if I use the "-force" flag:

C:\Windows\system32>powershell -command "Install-Module -Name VPNCredentialsHelper -force"

NuGet-anycpu.exe is required to continue.
PowerShellGet requires NuGet-anycpu.exe to interact with NuGet based galleries. NuGet-anycpu.exe must be available in
'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\WmWare\AppData\Local\PackageManagement\ProviderAssemblies'. For more information about NuGet provider, see
http://OneGet.org/NuGet.html. Do you want PowerShellGet to download NuGet-anycpu.exe now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

I want to skip this prompt and accept forcefully the following lines:

  1. rasdial.exe Name_VPN /disconnect
  2. PowerShell.exe -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force"
  3. PowerShell.exe -Command "Set-PSRepository -Name 'VPNCredentialsHelper' -InstallationPolicy Trusted"
  4. PowerShell.exe -Command "Install-Module -Name VPNCredentialsHelper -Force"
  5. PowerShell.exe -Command "Add-VpnConnection -Name Name_VPN -ServerAddress " + servertxt.Text.Trim() + " -AllUserConnection -AuthenticationMethod MSChapv2 -EncryptionLevel Required -Force -L2tpPsk " + psktxt.Text.Trim() + " -PassThru -RememberCredential -TunnelType L2tp"
  6. PowerShell.exe -Command "Set-VpnConnectionUsernamePassword -connectionname Name_VPN -username " + usernametxt.Text.Trim() + " -password " + passwordtxt.Text.Trim() + " -DnsSuffix "192.168.0.0/24" //values added from UI

I have the following version:

C:\Windows\system32>powershell $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.0.10240.16384
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.42000
BuildVersion                   10.0.10240.16384
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
6
  • -Force has no meaning regarding module retrieval. Depending on the PowerShellGet version, it has no effect whatsoever.
    – Daniel B
    Commented Jul 7 at 11:45
  • @DanielB I left the following steps: 1. deconnecting VPN, 2. uninstalling VPN, installing VPN and now it's fine. But I have a question: for connecting I use rasdial vpn_name user pw. I use 2 different VMs (192.168.0.166, 192.168.0.194) to test the app, but when I connect with one, the other disconnects and vice-versa. It's normal? In a "real life" situation will this work? Thanks Commented Jul 7 at 21:08
  • What you want won’t be possible, you essentially want to bypass a security measure, that prevents scripts from downloading malicious modules. The interactive prompt is there for your security, if you want to avoid the prompt entirely, download the module and have it already available to the script. It’s not clear what “it” is when you ask if it’s normal or what “real life” situation you might be referring to
    – Ramhound
    Commented Jul 8 at 7:39
  • @Ramhound sorry, I'm not an expert in Networking. I wanted to ask, if it normal that in a network with 2x PCs, If I connect one of them to a VPN, the other can't connect to the same VPN? Commented Jul 8 at 21:36
  • I don’t see that connection in your question, I see you asking about a prompt, to download a module.
    – Ramhound
    Commented Jul 8 at 22:31

0

You must log in to answer this question.

Browse other questions tagged .