0
我已经写了一个验证脚本,其中包含几个测试,脚本在每台计算机上借助工具在本地运行。但是,仅在脚本部分下方成功运行要调用的域用户名和密码。Powershell脚本需要调用的域用户名和密码
谁能帮我添加用户名和密码来调用下面的脚本(如:用户名:OIM \ test,密码:测试@ 123)
if (($ImageName -like "*devel*") -or ($ImageName -like "*hosted*"))
{
#$ADE1 = Invoke-Expression ('C:\ade\bin\ade.exe | select-string -pattern "begintrans"') | out-string ; $ADE = $ADE1.trim().split("")[1]
Invoke-Expression ('C:\ade\bin\ade.exe | select-string -pattern "begintrans"') > C:\Temp\ade_check.txt
$ADE1 = Get-Content C:\Temp\ade_check.txt | Select-String "begintrans" | out-string ; $ADE = $ADE1.trim().split(" ")[1]
if ($ADE -eq "begintrans")
{
$ADE = "ADE Installation Success"
Add-Content $report "<tr>"
Add-Content $report "<td bgcolor= 'White' height='30' align=center><B>17</B></td>"
Add-Content $report "<td bgcolor= 'White' height='30' align=left><B>ADE</B></td>"
Add-Content $report "<td bgcolor= 'Aquamarine' height='30' align=left><B>$ADE</B></td>"
Add-Content $report "</tr>"
echo "ADE = ADE Installation Success"
}
if ($ADE -eq $null){
$ADE = "ADE Installation Failed"
Add-Content $report "<tr>"
Add-Content $report "<td bgcolor= 'White' height='30' align=center><B>17</B></td>"
Add-Content $report "<td bgcolor= 'White' height='30' align=left><B>ADE</B></td>"
Add-Content $report "<td bgcolor= 'red' height='30' align=left><B>$ADE</B></td>"
Add-Content $report "</tr>"
echo "ADE = ADE Installation Failed"
}
}
else
{
if (($ImageName -like "*simple*") -or ($ImageName -like "*BareOS*")){
$ADE = "BareOS, ADE Not Installed"
Add-Content $report "<tr>"
Add-Content $report "<td bgcolor= 'White' height='30' align=center><B>17</B></td>"
Add-Content $report "<td bgcolor= 'White' height='30' align=left><B>ADE</B></td>"
Add-Content $report "<td bgcolor= 'Yellow' height='30' align=left><B>$ADE</B></td>"
Add-Content $report "</tr>"
echo "ADE = BareOS, ADE Not Installed"
}
}
非常感谢基里尔。它工作完美 – SNair
@SNair,你可能想把我的答案标记为答案,这样可以帮助那些正在寻找类似解决方案的人。 :-) –