Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 从csv文件导入AD中带有Powershell的用户和组_Windows_Powershell_Csv_Import_Active Directory - Fatal编程技术网

Windows 从csv文件导入AD中带有Powershell的用户和组

Windows 从csv文件导入AD中带有Powershell的用户和组,windows,powershell,csv,import,active-directory,Windows,Powershell,Csv,Import,Active Directory,我对Powershell很陌生 我在一个云环境中工作,与一些用户和组一起创建了一个Active Directory,不得不关闭我工作的服务器。 为了复制和拥有完全相同的环境,我使用了以下代码 Get-ADUser -Filter * -Properties * | Export-Csv -Path ExportUsers.csv 而且 Get-ADGroup -Filter * -Properties * | Export-Csv -Path ExportGroups.csv 使用我的代码使

我对Powershell很陌生

我在一个云环境中工作,与一些用户和组一起创建了一个Active Directory,不得不关闭我工作的服务器。 为了复制和拥有完全相同的环境,我使用了以下代码

Get-ADUser -Filter * -Properties * | Export-Csv -Path ExportUsers.csv
而且

Get-ADGroup -Filter * -Properties * | Export-Csv -Path ExportGroups.csv
使用我的代码使用Powershell从Active Directory导出所有用户和组,以便导出用户和组的所有信息

现在,我已经在我的笔记本电脑中创建了一个具有新Active Directory的虚拟机,并且至少我创建了与我在云中拥有的相同的域名(只是为了以一种尽可能简单的方式开始)。 我现在无法导入文件中所有属性的所有组和所有用户。我在几个线程中看到有人创建了一些脚本,在文件中插入他们需要的所有参数。事实上,我希望拥有用户的所有信息,因此我正在尝试更简单的方法来导入所有数据,而不必确切说明我需要的字段(我需要一切!) 出口很简单,所以我希望进口应该是一样的

我的csv文件中关于用户的标题列如下所示:

AccountExpirationDate,“accountExpires”,“AccountLockoutTime”,“AccountNotDelegate”,“adminCount”,“AllowVersionPasswordEncryption”,“BadLogonCount”,“badPasswordTime”,“badPwdCount”,“CannotChangePassword”,“CanonicalName”,“Certificates”,“City”,“CN”,“codePage”,“Company”,“Country”,“countryCode”,“Created”,“CreateTimstamp”,“Deleted”,“Department”,“描述”、“显示名称”、“区分名称”、“分区”、“不需要删除”、“DSCORE传播数据”、“电子邮件地址”、“员工ID”、“员工编号”、“启用”、“传真”、“给定名称”、“HomeDirectory”、“HomedirRequired”、“HomeDrive”、“主页”、“HomePhone”、“首字母缩写”、“instanceType”、“isCriticalSystemObject”、“isDeleted”、“LastBadPasswordEntry”、”LastKnownParent、LastLogonOff、LastLogonData、LastLogonItemStamp、LockedOut、logonCount、logonHours、LogonWorkstations、Manager、MemberOf、MNSLogonAccount、MobilePhone、Modified、modifyTimeStamp、msDS SupportedEncryptionTypes、msDS用户帐户控制Computed、Name、nTSecurityDescriptor、ObjectCategory、ObjectClass、ObjectGUID、objectSid、Office、OfficePhone、Organization、OtherName、PasswordExpired、PasswordLastSet、PasswordNeverExpires、PasswordNotRequired、POBox、PostalCode、PrimaryGroup、primaryGroupID、ProfilePath、ProtectedfromAccidentalDelete、pwdLastSet、SamAccountName、sAMAccountType、ScriptPath、sDRightsEffective“ServicePrincipalNames、SID、SIDHistory、SmartcardLogonRequired、State、StreetAddress、姓氏、头衔、TrustedTouthDelegation、TrustedTouthDelegation、UseDESKeyOnly、userAccountControl、userCertificate、UserPrincipalName、uSNChanged、uSNCreated、whenChanged、whenCreated

这只是一个用户的输入

,“9223372036854775807”,“False”,“False”,“0”,“0”,“0”,“True”,“mydomain.com/Users/Guest”,“Microsoft.ActiveDirectory.Management.ADPropertyValueCollection”,“Guest”,“0”,“0”,“0”,“3/21/2014 2:00:02 PM”,“用于来宾访问计算机/域的内置帐户”,“CN=Guest,CN=Users,DC=mydomain,DC=com”,“False”,“False”Microsoft.ActiveDirectory.Management.ADPropertyValueCollection“,,,,“False”,“False”,“False”,“0”,“0”,“False”,“0”,“0”,“Microsoft.ActiveDirectory.Management.ADPropertyValueCollection”,“False”,“2014年3月21日下午2:00:02”,“2014年3月21日下午2:00:02”,“0”,“Guest”,“System.DirectoryServices.ActiveDirectorySecurity”,“CN=Person,CN=Schema,CN=Configuration,DC=mydomain,DC=com,“用户”,“b3cdb85f-aa85-41e8-a36a-1e9cabb03bf2”,“S-1-5-21-1277972300-3555916100-1183092696-501”,“假”,“假”,“假”,“假”,“假”,“域来宾”,“CN=Users,DC=mydomain,DC=com”,“514”,“假”,“0”,“来宾”,“805306368”,“15”,“Microsoft.ActiveDirectory.Management.ADPropertyValueCollection”,“S-1-5-21-1277972300-3555916100-1183092696-501,“Microsoft.ActiveDirectory.Management.ADPropertyValueCollection”、“False”、“False”、“False”、“66082”、“Microsoft.ActiveDirectory.Management.ADPropertyValueCollection”、“8197”、“2014年3月21日下午2:00:02”、“2014年3月21日下午2:00:02”

并且,以类似的方式,我导出了所有组,因此现在我有了一个带有以下标题的csv:

“adminCount”、“CanonicalName”、“CN”、“Created”、“createTimeStamp”、“Deleted”、“Description”、“DisplayName”、“DifferentiedName”、“dSCorePropagationData”、“GroupCategory”、“GroupScope”、“groupType”、“HomePage”、“instanceType”、“isCriticalSystemObject”、“isDeleted”、“LastKnownPart”、“ManagedBy”、“member”、“MemberOf”、“Members”、“modifyTimeStamp”、“Name”,“nTSecurityDescriptor”、“ObjectCategory”、“ObjectClass”、“ObjectGUID”、“objectSid”、“ProtectedfromAccidentalDelete”、“SamAccountName”、“sAMAccountType”、“sDRightsEffective”、“SID”、“SIDHistory”、“systemFlags”、“uSNChanged”、“uSNCreated”、“whenChanged”、“whenCreated”

和一个条目的示例

1、“prestige.com/Builtin/Administrators”、“Administrators”、“2014年3月21日下午2:00:02”、“2014年3月21日下午2:00:02”、“Administrators对计算机/域具有完全且不受限制的访问权限”、“CN=Administrators、CN=Builtin、DC=prestige、DC=com”、“Microsoft.ActiveDirectory.Management.ADPropertyValueCollection”、“安全性”、“DomainLocal”、“-2147483643”、“4”、”True“,,,,,“Microsoft.ActiveDirectory.Management.ADPropertyValueCollection”,“Microsoft.ActiveDirectory.Management.ADPropertyValueCollection”,“Microsoft.ActiveDirectory.Management.ADPropertyValueCollection”,“3/21/2014 2:18:22 PM”,“3/21/2014 2:18:22 PM”,“Administrators”,“System.DirectoryServices.ActiveDirectorySecurity”,“CN=Group,CN=Schema,CN=Configuration,DC=prestige,DC=com,“group”,“729af9dd-25ee-448e-a63e-72fa546aa83e”,“S-1-5-32-544”,“False”,“Administrators”,“536870912”,“15”,“S-1-5-32-544”,“Microsoft.ActiveDirectory.Management.ADPropertyValueCollection”,“1946157056”,“12711”,“8199”,“2014年3月21日下午2:18:22”,“2014年3月21日下午2:00:02”

进口铝的最佳方式是什么