标签: windows-server-2016

如何检查密码复杂性?

我正在使用 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

2
推荐指数
1
解决办法
2万
查看次数

如何在 Windows Server 2016 中成功拉取 Windows Nano Server docker 镜像?

我需要在 Windows Server 2016 中运行 Nano 服务器 docker 映像,但每当我尝试拉取映像时都会重试..模式,我需要一些建议来解决它。命令是: docker pull mcr.microsoft.com/windows/nanoserver:10.0.14393.953

在此输入图像描述

docker windows-server-2016 nano-server

2
推荐指数
1
解决办法
5174
查看次数

从 X509 证书读取 RSA 私钥会导致 Windows Server 2016 与 Windows Server 2019 上的不同输出

这是我的问题:

\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

读取证书密钥的代码是:

\n
using (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

预先感谢您的任何帮助!

\n

cryptography rsa x509 windows-server-2016 windows-server-2019

2
推荐指数
1
解决办法
413
查看次数

当用引号括起来时,Write-Host 会打印整个对象而不是它的一个属性

$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 windows-server-2016 windows-server-2019

2
推荐指数
1
解决办法
1758
查看次数

为什么在这个 powershell 命令中使用括号

我是 Powershell 的新手,有人可以向我解释为什么括号和点用于:

(get-cluster).PreferredSite="SiteA"
Run Code Online (Sandbox Code Playgroud)

为什么不只是:

get-cluster | set-preferredSite -Name SiteA
Run Code Online (Sandbox Code Playgroud)

windows powershell windows-server-2016

1
推荐指数
1
解决办法
467
查看次数

尝试使用 Install-Module 在 Windows Server 2016 中安装 Docker 时出错

我尝试在 Windows Server 2016 中安装 Docker,但没有成功:

\n\n
PS 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

1
推荐指数
1
解决办法
2万
查看次数

500 - Internal server error with no details

Client gave me a server with public ip. I could see default IIS page in browser locally. Then I did following steps

  1. I published solution (Asp.Net MVC) on my file system.
  2. Copied published folder on server.
  3. Created new website in IIS.
  4. Stopped default web site as it was using port 80.
  5. Assigned port 80 to newly created website.
  6. Opened ip again in browser but it gave me 500 - Internal Server Error.

I made sure following configuration is there in …

iis asp.net-mvc windows-server-2016

1
推荐指数
1
解决办法
50
查看次数

在azure虚拟机上部署网站并访问互联网

我想使用服务器 2016(Azure VM) 在 azure IIS 上部署一个网站,并希望在互联网上的任何地方访问它。我怎样才能做到这一点?我必须使用哪个 IP 地址来实现此目的?

iis virtual-machine azure windows-server-2016 azure-web-app-service

1
推荐指数
1
解决办法
9054
查看次数

windows服务器修改密码?Ctrl + Alt + Del 无法通过 OSK 工作;出现错误:“要使用按...时可用的命令”

我无法通过 OSK 更改 Windows Server 2016 密码。我收到以下错误:

要使用按 Ctrl + Alt + Del 时可用的命令,请单击您的用户标题并选择一个选项。

我花了很多时间,后来在microsoft.com上找到了答案。

remote-desktop windows-server-2016

1
推荐指数
1
解决办法
4283
查看次数

如何从 IIS Web Farm 中删除 X-Powered-By: ARR/3.0?

我被要求从托管网站中删除所有powered-by响应标头IIS/ARR一如既往,我遵循本文中的说明。我应用了所需的注册表配置,这是之前对我有用的唯一选项。其他选项似乎不是我的解决方案,因为第二个选项已弃用,第三个选项没有完全删除标头。我过去在其他基于 IIS 的网站上成功使用了这个解决方案(使用注册表项),但现在它在这种情况下不起作用。任何有关如何调试问题或其他潜在解决方案的想法都将受到高度赞赏。

iis windows-server windows-server-2016

1
推荐指数
1
解决办法
3608
查看次数

Java 1.8 Windows Server 2016 file.isDirectory始终为false

我在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的错误吗?

谢谢

java java-8 windows-server-2016

0
推荐指数
1
解决办法
59
查看次数