![](/img/trans.png)
[英]Can I request a client certificate from Active Directory CA with Powershell?
[英]powershell script running from local server but not from client in active directory
我有這個簡單的Powershell腳本,該腳本從AD獲取信息,並將其存儲在登錄時的桌面文件中。這在登錄組策略中。 當我用我的用戶(不是admin)登錄服務器時,腳本可以完美運行。 當我從客戶端計算機登錄時,它會運行,創建文件,但其中沒有任何信息。 有任何想法嗎?
$strName = $env:username
$ObjUser = Get-ADUser -Properties * -Filter {sAMAccountName -eq $strName} | select displayName, title, telephoneNumber, mail, sAMAccountName, fullname
$strtitle = $objuser.Title
$strphone = $objuser.telephoneNumber
$stremail = $objUser.mail
$folderlocation = [Environment]::GetFolderPath("Desktop")
$Filenam = "$folderLocation\\test.txt"
$SigName = $normalName + "-" + $strtitle + "-" + $strphone + "-" + $stremail | Out-File $Filenam
確保在目標系統中安裝了RSAT ,並且在“控制面板”中啟用了“用於Windows PowerShell的Active Directory模塊”,然后將以下內容添加到腳本頂部:
Import-Module ActiveDirectory
通常,PowerShell會在需要時自動加載模塊,但是有時您需要明確告知它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.