我使用下面的powershell创build一个运行AD凭据的服务。
但是,当我运行它时,我得到一个错误的行李(也在下面)。
如果我然后编辑服务,并通过services.mmcpipe理单元input完全相同的凭据它的作品? 我怎样才能解决这个问题?
Windows无法在本地计算机上启动“SamsService”服务。 错误1069:由于login失败,服务没有启动。
$serviceName = "SamsService" $exePath = "c:\services\service.exe" $userName = "mydomain\serviceuser" $securePassword = convertto-securestring -String "1a_really_$trong_password1" -AsPlainText -Force $credentialsObject = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $securePassword New-Service -BinaryPathName $exePath -Name $serviceName -Credential $credentialsObject -DisplayName $serviceName -StartupType Manual
我的密码生成器创build真正的强密码,总是包含$
我还没有意识到$是插入密码string中的意思是一个variables。 在用上面的代码转义$之后,就可以工作了。