[英]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.