0
所以我正在爲設置的靜態位置爲CSV我用於導入後的一段代碼。當我運行代碼似乎運行,直到我得到Windows無法打開此文件彈出。你知道你想要做什麼的選項,比如用戶Web服務來找到正確的程序。我正在複製代碼,所以希望有人能指出我在哪裏做這個fubar。只是音符之前我所做的CSV靜態腳本要求你在每次輸入內容的位置,所以也許我錯過了一個設置有powershell導入csv彈出
if ($args[0] -eq $null)
{
$userNameFile = D:\lync_creation\userlog.csv
$userNameFile = $usernamefile -replace '"',""}
else
{$usernamefile = $args[0]}
if ($userNameFile -ne "")
{$csv=import-csv $userNameFile}
else
{"Could not find a valid .csv with the user information."
exit}
foreach($c in $csv)
# enable for lync
{
"Enabling " + $c.Identity + " for Lync 2010"
Enable-csuser -identity $c.Identity -registrarpool pool01.west.com –sipaddresstype EmailAddress
}
write-host "Press any key to continue..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown,AllowCtrlC")
愛這比我的簡單多了。但我有一個問題,如果我嘗試執行此代碼。我收到關於Enable-CsUser的錯誤:無法將參數綁定到參數'Identity',因爲它爲空。這條線在舊代碼中工作。 – user3338871
我沒有改變那條線,或者它的ForEach循環。我不知道爲什麼現在會出錯,而不是之前。 – TheMadTechnician
我發現原因似乎有一些隱藏字符在CSV在身份線。 – user3338871