我正在使用 PowerShell 创建本地用户。我需要从键盘获取输入:用户名和密码。要获取密码,我可以使用以下方法之一:
$user_details = Get-Credential
Run Code Online (Sandbox Code Playgroud)
或者
$pass = Read-Host -assecureString "Please enter your password"
Run Code Online (Sandbox Code Playgroud)
在这两种情况下,我都会得到加密的密码变量System.Security.SecureString
。在这两种情况下,当我尝试创建用户时,
New-LocalUser -Name $username -Password $pass
Run Code Online (Sandbox Code Playgroud)
我收到错误消息,提示密码不复杂。
New-LocalUser:无法更新密码。为新密码提供的值不满足域的长度、复杂性或历史记录要求。”
由于密码是加密的,(System.Security.SecureString) 我无法知道密码的复杂性。如何强制用户输入符合复杂性规则的密码?
(使用未加密的密码对我来说不是一个好的解决方案)
更新:在几个与良好解决方案相关但不满足我的安全要求的答案之后,我想重新表述一下:
如何检查已存储在对象中的密码复杂性:System.Security.SecureString(无需解密)
powershell credentials password-encryption powershell-5.0 windows-server-2016
我需要在 Windows Server 2016 中运行 Nano 服务器 docker 映像,但每当我尝试拉取映像时都会重试..模式,我需要一些建议来解决它。命令是: docker pull mcr.microsoft.com/windows/nanoserver:10.0.14393.953
这是我的问题:
\n在 C#/.NET-4.8 中,我在两台服务器上使用带有 RSA 私钥的 P12 证书。\n一台服务器运行 Windows Server 2016,另一台服务器运行 Windows Server 2019。\n当我比较两台服务器上同一证书的 RSA 私钥时,输出不一样。\n\n\xe2\x80\x9cprivate exponent\xe2\x80\x9d(在 \xe2\x80\x9cD\xe2\x80\x9d 属性中找到)不一样。
\n有谁知道为什么会发生这种情况?
\n额外信息:\n每次运行时,代码都会(每个系统)输出相同的密钥(这当然很好)。\n代码在 Windows 10、Windows 11 和 Windows Server 2019 上输出相同的私钥,但在 Windows 上服务器2016就不一样了。
\n读取证书密钥的代码是:
\nusing (var rsaPrivateKey = _certificate.GetRSAPrivateKey())\n{\n var parameters = rsaPrivateKey.ExportParameters(true);\n privateExponent = BitConverter.ToString(parameters.D); // privateExponent (parameters.D) is the components which is not the same on each system.\n\n privateKeyXml = rsaPrivateKey.ToXmlString(true); // In privateKeyXml, only the privateExponent changes.\n}\n
Run Code Online (Sandbox Code Playgroud)\n预先感谢您的任何帮助!
\ncryptography rsa x509 windows-server-2016 windows-server-2019
$AllDrivesExceptBootDrive = Get-Volume | Where-Object {$_.DriveLetter -ne 'C'} | Select-Object DriveLetter, AllocationUnitSize
foreach ($d in $AllDrivesExceptBootDrive)
{
Write-Host "Checking Drive $d.DriveLetter"
}
Run Code Online (Sandbox Code Playgroud)
印刷:
Checking Drive @{DriveLetter=F; AllocationUnitSize=4096}.DriveLetter
Checking Drive @{DriveLetter=G; AllocationUnitSize=4096}.DriveLetter
Checking Drive @{DriveLetter=E; AllocationUnitSize=4096}.DriveLetter
Checking Drive @{DriveLetter=H; AllocationUnitSize=4096}.DriveLetter
Checking Drive @{DriveLetter=I; AllocationUnitSize=4096}.DriveLetter
Run Code Online (Sandbox Code Playgroud)
如何保留引号Write-Host
并仍按如下方式打印?
Checking Drive F
Checking Drive G
Checking Drive E
Checking Drive H
Checking Drive I
Run Code Online (Sandbox Code Playgroud) 我是 Powershell 的新手,有人可以向我解释为什么括号和点用于:
(get-cluster).PreferredSite="SiteA"
Run Code Online (Sandbox Code Playgroud)
为什么不只是:
get-cluster | set-preferredSite -Name SiteA
Run Code Online (Sandbox Code Playgroud) 我尝试在 Windows Server 2016 中安装 Docker,但没有成功:
\n\nPS C:\\Windows\\system32> Install-Module -Name "DockerMsftProvider" -Force -Verbose\nVERBOSE: Using the provider \'PowerShellGet\' for searching packages.\nVERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories.\nVERBOSE: Getting the provider object for the PackageManagement Provider \'NuGet\'.\nVERBOSE: The specified Location is \'https://www.powershellgallery.com/api/v2/\' and PackageManagementProvider is\n\'NuGet\'.\nVERBOSE: Searching repository \'https://www.powershellgallery.com/api/v2/FindPackagesById()?id=\'DockerMsftProvider\'\' for\n \'\'.\nVERBOSE: Total package yield:\'1\' for the specified package \'DockerMsftProvider\'.\nVERBOSE: Performing the operation "Install-Module" on target "Version \'1.0.0.1\' of module \'DockerMsftProvider\'".\nVERBOSE: The installation scope is …
Run Code Online (Sandbox Code Playgroud) windows powershell environment-variables docker windows-server-2016
Client gave me a server with public ip. I could see default IIS page in browser locally. Then I did following steps
I made sure following configuration is there in …
我想使用服务器 2016(Azure VM) 在 azure IIS 上部署一个网站,并希望在互联网上的任何地方访问它。我怎样才能做到这一点?我必须使用哪个 IP 地址来实现此目的?
iis virtual-machine azure windows-server-2016 azure-web-app-service
我无法通过 OSK 更改 Windows Server 2016 密码。我收到以下错误:
要使用按 Ctrl + Alt + Del 时可用的命令,请单击您的用户标题并选择一个选项。
我花了很多时间,后来在microsoft.com上找到了答案。
我被要求从托管网站中删除所有powered-by
响应标头IIS/ARR
。一如既往,我遵循本文中的说明。我应用了所需的注册表配置,这是之前对我有用的唯一选项。其他选项似乎不是我的解决方案,因为第二个选项已弃用,第三个选项没有完全删除标头。我过去在其他基于 IIS 的网站上成功使用了这个解决方案(使用注册表项),但现在它在这种情况下不起作用。任何有关如何调试问题或其他潜在解决方案的想法都将受到高度赞赏。
我在Windows Server 2016上使用Java 1.8,我的代码包含如下测试条件:
String path = "\\myserver\folder";
File file = new File(path);
if(file.isDirectory())
System.out.println("is a dir");
else
System.out.println("is not a dir");
Run Code Online (Sandbox Code Playgroud)
但总是返回值为false.我尝试了映射,创建了一个符号链接.我也尝试了java nio但没有改变.有谁知道为什么?它是Windows或Java的错误吗?
谢谢
powershell ×4
iis ×3
docker ×2
windows ×2
asp.net-mvc ×1
azure ×1
credentials ×1
cryptography ×1
java ×1
java-8 ×1
nano-server ×1
rsa ×1
x509 ×1