0
網絡應用程序,我想更新活動目錄中的信息。爲此,我使用System.Management.Automation命名空間。有了這個,我可以爲此使用Powershell。它工作得很好,但我不知道如何更新字段「extensionAttribute3」(這是我們的Costcenter)。如何使用PowerShell和System.Management.Automation在ASP.NET中更新字段extensionAttribute3?
這裏我的代碼:
...
PSCredential crend = new PSCredential(ADNAME, pw);
using (Runspace runspace = RunspaceFactory.CreateRunspace(initial))
{
runspace.Open();
using (Pipeline p = runspace.CreatePipeline())
{
Command command = new Command("Set-ADUser");
command.Parameters.Add("Identity", sAMAccountName);
//command.Parameters.Add("extensionAttribute3", CostCenter); ???
command.Parameters.Add("Description", Description);
command.Parameters.Add("Credential", crend);
p.Commands.Add(command);
p.Invoke();
}
}
...