在这里编写一个powershell脚本来将我们的AD中的一些数据填充到excelsheet中。我有一个虽然问题搏斗..在excelsheet中编写Powershell脚本
我用这条线来读出我想要的变量$帐户的东西:在foreach
$accounts = Get-ADUser -Filter * -SearchBase "OU=technicalaccounts,OU=ztechnical,DC=XXX,DC=XXX,DC=XX" -Properties memberof, passwordlastset, description, enabled
然后填补了excelsheet如下
$Sheet.Cells.Item($row,1).FormulaLocal = $value.name
$Sheet.Cells.Item($row,2).FormulaLocal = $value.description
$Sheet.Cells.Item($row,3).FormulaLocal = $value.passwordlastset
$Sheet.Cells.Item($row,4).FormulaLocal = $value.enabled
$Sheet.Cells.Item($row,5).FormulaLocal = $value.memberof
当它这样做的一个
$Sheet.Cells.Item($row,5).FormulaLocal = $value.memberof
错误说发生这种情况的问题:
Ausnahme BEIM Festlegen冯 “FormulaLocal”: “Ausnahme冯HRESULT:0x800A03EC” 在\ GET-TechUser.ps1:57贼臣:9 + $ Sheet.Cells.Item($行,5).FormulaLocal = $ value.memberof + ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ + CategoryInfo:NotSpecified:(:) [],SetValueInvocationException + FullyQualifiedErrorId:CatchFromBaseAdapterSetValueTI
这是一个数组有点事数组?
嘛反正感谢您的任何意见:)
的可能的复制[?如何获得的所有组用户是的成员(http://stackoverflow.com/questions/5072996/how-to-让 - 全组 - 即-A-用户是-A-成员的)。 – Jeeped
Nah不同的问题..但是,谢谢:) –