我在Windows Server 2019上,无法使用PowerShell安装html, body{
height: 100vh;
margin: 0px;
}
app-root {
display: block;
height: 100%;
}
。
CredentialManager
我收到以下错误:
PS C:\> Install-Module CredentialManager
我在Windows 2012和PowerShell v5上使用了相同的命令,并且可以正常工作。想法?
答案 0 :(得分:-1)
我在阻止此情况的公司防火墙后面。设置代理后,就可以安装PSGallery
。
$proxyhost = "your-proxy-url.com"
$proxyport = "1234"
$proxy = "$proxyhost" + ":" + $proxyport
$proxyurl = "http://" + "$proxy"
$proxyuser = "proxy-user"
$proxypwd = "proxy-pwd
# set up proxy credentials
$secPasswd = ConvertTo-SecureString $proxypwd -AsPlainText -Force
$credential = New-Object PSCredential($proxyuser, $secPasswd)
# Set up proxy with netsh
netsh winhttp set proxy proxy-server=$proxy bypass-list=$bypassList
# Recovering the PsGallery Repository behind a Corporate Proxy
[system.net.webrequest]::defaultwebproxy = new-object system.net.webproxy($proxyurl)
[system.net.webrequest]::defaultwebproxy.credentials = $credential
[system.net.webrequest]::defaultwebproxy.BypassProxyOnLocal = $true
if(!(Get-PSRepository "PSGallery")) {
Register-PSRepository -Name "PSGallery" –SourceLocation "https://www.powershellgallery.com/api/v2/" -InstallationPolicy Trusted
}