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,你可能想把我的答案標記爲答案,這樣可以幫助那些正在尋找類似解決方案的人。 :-) –