Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

612 lines
22 KiB

  1. Option Explicit
  2. '----------------------------------------------------------------------------
  3. ' ADMT Scripting Notes
  4. '----------------------------------------------------------------------------
  5. ' 1 - this template shows all the migration objects and all of the properties
  6. ' and methods of the various migration objects even though a normal
  7. ' script would not use all of the objects and properties
  8. ' 2 - optional properties are commented out with the default value shown
  9. ' being assigned
  10. ' 3 - service account enumeration would normally occur before user account
  11. ' migration so that services may be updated during user account migration
  12. '----------------------------------------------------------------------------
  13. ' ADMT Scripting Constants
  14. '----------------------------------------------------------------------------
  15. ' RenameOption constants
  16. Const admtDoNotRename = 0
  17. Const admtRenameWithPrefix = 1
  18. Const admtRenameWithSuffix = 2
  19. ' PasswordOption constants
  20. Const admtPasswordFromName = 0
  21. Const admtComplexPassword = 1
  22. Const admtCopyPassword = 2
  23. ' ConflictOptions constants
  24. Const admtIgnoreConflicting = &H0000
  25. Const admtReplaceConflicting = &H0001
  26. Const admtRenameConflictingWithPrefix = &H0002
  27. Const admtRenameConflictingWithSuffix = &H0003
  28. Const admtRemoveExistingUserRights = &H0010
  29. Const admtRemoveExistingMembers = &H0020
  30. Const admtMoveReplacedAccounts = &H0040
  31. ' DisableOption constants
  32. Const admtEnableTarget = 0
  33. Const admtDisableSource = 1
  34. Const admtDisableTarget = 2
  35. Const admtTargetSameAsSource = 4
  36. ' SourceExpiration constant
  37. Const admtNoExpiration = -1
  38. ' Translation Option
  39. Const admtTranslateReplace = 0
  40. Const admtTranslateAdd = 1
  41. Const admtTranslateRemove = 2
  42. ' Report Type
  43. Const admtReportMigratedAccounts = 0
  44. Const admtReportMigratedComputers = 1
  45. Const admtReportExpiredComputers = 2
  46. Const admtReportAccountReferences = 3
  47. Const admtReportNameConflicts = 4
  48. ' Option constants
  49. Const admtNone = 0
  50. Const admtData = 1
  51. Const admtFile = 2
  52. Const admtDomain = 3
  53. Const admtRecurse = &H0100
  54. Const admtFlattenHierarchy = &H0000
  55. Const admtMaintainHierarchy = &H0200
  56. '----------------------------------------------------------------------------
  57. ' Declarations
  58. '----------------------------------------------------------------------------
  59. Dim objMigration
  60. Dim objUserMigration
  61. Dim objGroupMigration
  62. Dim objComputerMigration
  63. Dim objSecurityTranslation
  64. Dim objServiceAccountEnumeration
  65. '----------------------------------------------------------------------------
  66. ' ADMT Migration Class
  67. '
  68. ' TestMigration Property
  69. ' - specifies whether a test migration will be performed
  70. ' - optional, the default value is false
  71. '
  72. ' IntraForest Property
  73. ' - specifies whether the migration is intra-forest or inter-forest
  74. ' - the default is inter-forest migration
  75. '
  76. ' SourceDomain Property
  77. ' - specifies the source domain name
  78. ' - the source domain may be specified in either DNS or Flat format
  79. ' - eg. DNS "mydomain.mycompany.com" or Flat "MYDOMAIN"
  80. ' - the source domain must be specified
  81. '
  82. ' SourceOU Property
  83. ' - specifies the source organizational unit (OU)
  84. ' - this property is only applicable for up-level domains (Windows 2000 or later)
  85. ' - the OU must be specified in relative canonical format
  86. ' - eg. "West/Sales"
  87. '
  88. ' TargetDomain Property
  89. ' - specifies the target domain name
  90. ' - the target domain may be specified in either DNS or Flat format
  91. ' - eg. DNS "mydomain.mycompany.com" or Flat "MYDOMAIN"
  92. ' - the target domain must be specified
  93. '
  94. ' TargetOU Property
  95. ' - specifies the target organizational unit (OU)
  96. ' - the OU must be specified in relative canonical format
  97. ' - eg. "West/Sales"
  98. '
  99. ' RenameOption Property
  100. ' - specifies how migrated accounts are to be renamed
  101. ' - optional, default is admtDoNotRename
  102. '
  103. ' RenamePrefixOrSuffix Property
  104. ' - specifies the prefix or suffix to be added to account names
  105. ' - applicable only if RenameOption is admtRenameWithPrefix or
  106. ' admtRenameWithSuffix
  107. '
  108. ' PasswordOption Property
  109. ' - specifies how to generate passwords for migrated accounts
  110. ' - applicable only for inter-forest user migrations and inter-forest group
  111. ' migrations when migrating member users
  112. ' - optional, default is admtPasswordFromName
  113. '
  114. ' PasswordServer Property
  115. ' - specifies the server that is to be used for copying passwords
  116. ' - applicable only for inter-forest user migrations and inter-forest group
  117. ' migrations when migrating member users
  118. ' - only applicable if password option specifies copying
  119. '
  120. ' PasswordFile Property
  121. ' - specifies the path of the password file to be created
  122. ' - applicable only for inter-forest user migrations and inter-forest group
  123. ' migrations when migrating member users
  124. ' - optional, default path is the 'Logs' folder in the ADMT installation
  125. ' directory
  126. '
  127. ' ConflictOptions Property
  128. ' - specifies how to handle accounts being migrated that have a naming
  129. ' conflict with a target domain account
  130. ' - the following are the allowable values
  131. ' admtIgnoreConflicting
  132. ' admtReplaceConflicting
  133. ' admtReplaceConflicting + admtRemoveExistingUserRights
  134. ' admtReplaceConflicting + admtRemoveExistingMembers
  135. ' admtReplaceConflicting + admtRemoveExistingUserRights + admtRemoveExistingMembers
  136. ' admtRenameConflictingWithPrefix
  137. ' admtRenameConflictingWithSuffix
  138. ' - optional, default is admtIgnoreConflicting
  139. '
  140. ' ConflictPrefixOrSuffix Property
  141. ' - specifies the prefix or suffix to be added to migrated account names
  142. ' that have a naming conflict with a target domain account
  143. ' - applicable only if ConflictOptions is admtRenameConflictingWithPrefix or
  144. ' admtRenameConflictingWithSuffix
  145. '
  146. ' UserPropertiesToExclude
  147. ' - specifies user properties that are not to be copied from source to target.
  148. '
  149. ' GroupPropertiesToExclude
  150. ' - specifies group properties that are not to be copied from source to target.
  151. '
  152. ' ComputerPropertiesToExclude
  153. ' - specifies computer properties that are not to be copied from source to target.
  154. '
  155. ' CreateUserMigration Method
  156. ' - creates an instance of a user migration object
  157. '
  158. ' CreateGroupMigration Method
  159. ' - creates an instance of a group migration object
  160. '
  161. ' CreateComputerMigration Method
  162. ' - creates an instance of a computer migration object
  163. '
  164. ' CreateSecurityTranslation Method
  165. ' - creates an instance of a security translation object
  166. '
  167. ' CreateServiceAccountEnumeration Method
  168. ' - creates an instance of a service account enumeration object
  169. '
  170. ' CreateReportGeneration Method
  171. ' - creates an instance of a report generation object
  172. '----------------------------------------------------------------------------
  173. ' create instance of migration object
  174. Set objMigration = CreateObject("ADMT.Migration")
  175. ' set options
  176. 'objMigration.TestMigration = False
  177. 'objMigration.IntraForest = False
  178. objMigration.SourceDomain = "MYSOURCEDOMAIN"
  179. 'objMigration.SourceOU = ""
  180. objMigration.TargetDomain = "mytargetdomain.mycompany.com"
  181. objMigration.TargetOU = "Users"
  182. 'objMigration.RenameOption = admtDoNotRename
  183. 'objMigration.RenamePrefixOrSuffix = ""
  184. 'objMigration.PasswordOption = admtPasswordFromName
  185. 'objMigration.PasswordServer = ""
  186. 'objMigration.PasswordFile = "C:\Program Files\Active Directory Migration Tool\Logs\Password.txt"
  187. 'objMigration.ConflictOptions = admtIgnoreConflicting
  188. 'objMigration.ConflictPrefixOrSuffix = ""
  189. 'objMigration.UserPropertiesToExclude = "mail,company"
  190. 'objMigration.GroupPropertiesToExclude = "description"
  191. 'objMigration.ComputerPropertiesToExclude = "description"
  192. '----------------------------------------------------------------------------
  193. ' UserMigration Class
  194. '
  195. ' DisableOption Property
  196. ' - specifies whether to disable source or target account
  197. ' - applicable only for inter-forest migration
  198. ' - optional, default is admtEnableTarget
  199. '
  200. ' SourceExpiration Property
  201. ' - specifies the expiration period of the source account in days
  202. ' - a value of admtNoExpiration specifies no source account expiration
  203. ' - applicable only for inter-forest migration
  204. ' - optional, default is admtNoExpiration
  205. '
  206. ' MigrateSIDs Property
  207. ' - specifies whether to migrate security identifiers to the target domain
  208. ' - applicable only for inter-forest migration
  209. ' - optional, default is false
  210. '
  211. ' TranslateRoamingProfile Property
  212. ' - specifies whether to perform security translation on roaming profiles
  213. ' - optional, default is false
  214. '
  215. ' UpdateUserRights Property
  216. ' - specifies whether to update user rights in the domain
  217. ' - optional, default is false
  218. '
  219. ' MigrateGroups Property
  220. ' - specifies whether to migrate groups that have as members accounts being
  221. ' migrated
  222. ' - optional, default is false
  223. '
  224. ' UpdatePreviouslyMigratedObjects Property
  225. ' - specifies whether previously migrated accounts should be re-migrated
  226. ' - applicable only for inter-forest migration
  227. ' - optional, default is false
  228. '
  229. ' FixGroupMembership Property
  230. ' - specifies whether group memberships will be re-established for migrated
  231. ' accounts
  232. ' - optional, default is true
  233. '
  234. ' MigrateServiceAccounts Property
  235. ' - specifies whether to migrate service accounts
  236. ' - optional, default is true
  237. '
  238. ' Migrate Method
  239. ' - migrate specified user accounts
  240. ' - the first parameter specifies whether the names are directly specified or
  241. ' the names are contained in the specified file or the names are to be
  242. ' enumerated from the specified domain or ou
  243. ' - the second parameter specifies the account names to be included
  244. ' - the third parameter optionally specifies names which are to be excluded
  245. '
  246. ' - Note: Only the specified source OU will be used whether names are
  247. ' directly specified or specified in a file or the domain is
  248. ' searched. If no source OU is specified than the root of the domain
  249. ' is used.
  250. '----------------------------------------------------------------------------
  251. ' create instance of user migration object
  252. Set objUserMigration = objMigration.CreateUserMigration
  253. ' set options
  254. 'objUserMigration.DisableOption = admtEnableTarget
  255. 'objUserMigration.SourceExpiration = admtNoExpiration
  256. 'objUserMigration.MigrateSIDs = False
  257. 'objUserMigration.TranslateRoamingProfile = False
  258. 'objUserMigration.UpdateUserRights = False
  259. 'objUserMigration.MigrateGroups = False
  260. 'objUserMigration.UpdatePreviouslyMigratedObjects = False
  261. 'objUserMigration.FixGroupMembership = True
  262. 'objUserMigration.MigrateServiceAccounts = False
  263. ' migrate user accounts
  264. ' the following are some examples of specifying the names and exclude names
  265. objUserMigration.Migrate admtData, "CN=User1"
  266. objUserMigration.Migrate admtData, Array("/Users/User3","\User4")
  267. objUserMigration.Migrate admtFile, "C:\Users.txt", Array("begins_with*","*contains*","*ends_with")
  268. objUserMigration.Migrate admtDomain, , "C:\ExcludeNames.txt"
  269. '----------------------------------------------------------------------------
  270. ' GroupMigration Class
  271. '
  272. ' UpdateGroupRights Property
  273. ' - specifies whether to update group domain rights
  274. ' - optional, default is false
  275. '
  276. ' UpdatePreviouslyMigratedObjects Property
  277. ' - specifies whether previously migrated accounts should be re-migrated
  278. ' - applicable only for inter-forest migration
  279. ' - optional, default is false
  280. '
  281. ' FixGroupMembership Property
  282. ' - specifies whether group memberships will be re-established for migrated
  283. ' accounts
  284. ' - optional, default is true
  285. '
  286. ' MigrateSIDs Property
  287. ' - specifies whether to migrate security identifiers to the target domain
  288. ' - applicable only for inter-forest migration
  289. ' - optional, default is false
  290. '
  291. ' MigrateMembers Property
  292. ' - specifies whether to migrate members of groups during migration
  293. ' - optional, default is false
  294. '
  295. ' DisableOption Property
  296. ' - specifies whether to disable source user accounts or target user accounts
  297. ' when copying members
  298. ' - applicable only if copying members in an inter-forest migration
  299. ' - optional, default is admtEnableTarget
  300. '
  301. ' SourceExpiration Property
  302. ' - specifies the expiration period of source user accounts in days when
  303. ' copying members
  304. ' - a value of admtNoExpiration specifies no source user account expiration
  305. ' - applicable only if copying members in an inter-forest migration
  306. ' - optional, default is admtNoExpiration
  307. '
  308. ' TranslateRoamingProfile Property
  309. ' - specifies whether to perform security translation on roaming profiles
  310. ' - applicable only if copying members in an inter-forest migration
  311. ' - optional, default is false
  312. '
  313. ' Migrate Method
  314. ' - migrate specified group accounts
  315. ' - the first parameter specifies whether the names are directly specified or
  316. ' the names are contained in the specified file or the names are to be
  317. ' enumerated from the specified domain or ou
  318. ' - the second parameter specifies the account names to be included
  319. ' - the third parameter optionally specifies names which are to be excluded
  320. '
  321. ' - Note: Only the specified source OU will be used whether names are
  322. ' directly specified or specified in a file or the domain is
  323. ' searched. If no source OU is specified than the root of the domain
  324. ' is used.
  325. '----------------------------------------------------------------------------
  326. ' create instance of group migration object
  327. Set objGroupMigration = objMigration.CreateGroupMigration
  328. ' set options
  329. 'objGroupMigration.MigrateSIDs = False
  330. 'objGroupMigration.UpdateGroupRights = False
  331. 'objGroupMigration.UpdatePreviouslyMigratedObjects = False
  332. 'objGroupMigration.FixGroupMembership = True
  333. 'objGroupMigration.MigrateMembers = False
  334. 'objGroupMigration.DisableOption = admtDisableNeither
  335. 'objGroupMigration.SourceExpiration = admtNoExpiration
  336. 'objGroupMigration.TranslateRoamingProfile = False
  337. ' migrate group accounts
  338. ' the following are some examples of specifying the names and exclude names
  339. objGroupMigration.Migrate admtData, "CN=Group1"
  340. objGroupMigration.Migrate admtData, Array("/Users/Group3","\Group4")
  341. objGroupMigration.Migrate admtFile, "C:\Groups.txt", Array("begins_with*","*contains*","*ends_with")
  342. objGroupMigration.Migrate admtDomain, , "C:\ExcludeNames.txt"
  343. '----------------------------------------------------------------------------
  344. ' ComputerMigration Class
  345. '
  346. ' - the following translate options specify whether to perform security
  347. ' translation on that type of objects during the computer migration
  348. '
  349. ' TranslateFilesAndFolders Property
  350. ' - specifies whether to perform security translation on files and folders
  351. ' - optional, default is false
  352. '
  353. ' TranslateLocalGroups Property
  354. ' - specifies whether to perform security translation on local groups
  355. ' - optional, default is false
  356. '
  357. ' TranslatePrinters Property
  358. ' - specifies whether to perform security translation on printers
  359. ' - optional, default is false
  360. '
  361. ' TranslateRegistry Property
  362. ' - specifies whether to perform security translation on registry
  363. ' - optional, default is false
  364. '
  365. ' TranslateShares Property
  366. ' - specifies whether to perform security translation on shares
  367. ' - optional, default is false
  368. '
  369. ' TranslateUserProfiles Property
  370. ' - specifies whether to perform security translation on user profiles
  371. ' - optional, default is false
  372. '
  373. ' TranslateUserRights Property
  374. ' - specifies whether to perform security translation on user rights
  375. ' - optional, default is false
  376. '
  377. ' RestartTime Property
  378. ' - specifies the time in minutes to wait before re-booting the computers
  379. ' after migrating
  380. ' - the valid range is 1 to 10 minutes
  381. ' - optional, default is 5 minutes
  382. '
  383. ' Migrate Method
  384. ' - migrate specified computer accounts
  385. ' - the first parameter specifies whether the names are directly specified or
  386. ' the names are contained in the specified file or the names are to be
  387. ' enumerated from the specified domain or ou
  388. ' - the second parameter specifies the account names to be included
  389. ' - the third parameter optionally specifies names which are to be excluded
  390. '
  391. ' - Note: Only the specified source OU will be used whether names are
  392. ' directly specified or specified in a file or the domain is
  393. ' searched. If no source OU is specified than the root of the domain
  394. ' is used.
  395. '----------------------------------------------------------------------------
  396. ' create instance of computer migration object
  397. Set objComputerMigration = objMigration.CreateComputerMigration
  398. ' set options
  399. 'objComputerMigration.TranslationOption = admtTranslateAdd
  400. 'objComputerMigration.TranslateFilesAndFolders = False
  401. 'objComputerMigration.TranslateLocalGroups = False
  402. 'objComputerMigration.TranslatePrinters = False
  403. 'objComputerMigration.TranslateRegistry = False
  404. 'objComputerMigration.TranslateShares = False
  405. 'objComputerMigration.TranslateUserProfiles = False
  406. 'objComputerMigration.TranslateUserRights = False
  407. 'objComputerMigration.RestartDelay = 1
  408. ' migrate computer accounts
  409. ' the following are some examples of specifying the names and exclude names
  410. objComputerMigration.Migrate admtData, "CN=Computer1"
  411. objComputerMigration.Migrate admtData, Array("/Computers/Computer3","\Computer4")
  412. objComputerMigration.Migrate admtFile, "C:\Computers.txt", Array("begins_with*","*contains*","*ends_with")
  413. objComputerMigration.Migrate admtDomain, , "C:\ExcludeNames.txt"
  414. '----------------------------------------------------------------------------
  415. ' SecurityTranslation Class
  416. '
  417. ' TranslationOption
  418. ' - specifies whether to add, replace or remove entries from access control lists
  419. '
  420. ' TranslateFilesAndFolders Property
  421. ' - specifies whether to perform security translation on files and folders
  422. ' - optional, default is false
  423. '
  424. ' TranslateLocalGroups Property
  425. ' - specifies whether to perform security translation on local groups
  426. ' - optional, default is false
  427. '
  428. ' TranslatePrinters Property
  429. ' - specifies whether to perform security translation on printers
  430. ' - optional, default is false
  431. '
  432. ' TranslateRegistry Property
  433. ' - specifies whether to perform security translation on registry
  434. ' - optional, default is false
  435. '
  436. ' TranslateShares Property
  437. ' - specifies whether to perform security translation on shares
  438. ' - optional, default is false
  439. '
  440. ' TranslateUserProfiles Property
  441. ' - specifies whether to perform security translation on user profiles
  442. ' - optional, default is false
  443. '
  444. ' TranslateUserRights Property
  445. ' - specifies whether to perform security translation on user rights
  446. ' - optional, default is false
  447. '
  448. ' SidMappingFile Property
  449. ' - specifies whether to use a mapping of SIDs from specified file
  450. ' - if a SID mapping file is not specified, then security translation
  451. ' maps SIDs from previously migration objects
  452. ' - optional, default is none
  453. '
  454. ' Translate Method
  455. ' - perform security translation on specified computers
  456. ' - the first parameter specifies whether the names are directly specified or
  457. ' the names are contained in the specified file or the names are to be
  458. ' enumerated from the specified domain or ou
  459. ' - the second parameter specifies the account names to be included
  460. ' - the third parameter optionally specifies names which are to be excluded
  461. ' - if specifying NT4 style names for Windows 2000, or greater, domains the name must be
  462. ' preceded with a backslash
  463. ' eg. \NT4Name
  464. '
  465. ' - Note: The source domain and OU will be used if not explicitly specified
  466. '----------------------------------------------------------------------------
  467. ' create instance of security translation object
  468. Set objSecurityTranslation = objMigration.CreateSecurityTranslation
  469. ' set options
  470. 'objSecurityTranslation.TranslationOption = admtTranslateAdd
  471. 'objSecurityTranslation.TranslateFilesAndFolders = False
  472. 'objSecurityTranslation.TranslateLocalGroups = False
  473. 'objSecurityTranslation.TranslatePrinters = False
  474. 'objSecurityTranslation.TranslateRegistry = False
  475. 'objSecurityTranslation.TranslateShares = False
  476. 'objSecurityTranslation.TranslateUserProfiles = False
  477. 'objSecurityTranslation.TranslateUserRights = False
  478. 'objSecurityTranslation.SidMappingFile = "C:\SidMappingFile.txt"
  479. ' translate security on specified computers
  480. ' the following are some examples of specifying the names and exclude names
  481. objSecurityTranslation.Translate admtData, "CN=Computer2"
  482. objSecurityTranslation.Translate admtData, Array("/Computers/Computer3","\Computer4")
  483. objSecurityTranslation.Translate admtFile, "C:\Computers.txt", Array("begins_with*","*contains*","*ends_with")
  484. objSecurityTranslation.Translate admtDomain, , "C:\ExcludeNames.txt"
  485. '----------------------------------------------------------------------------
  486. ' ServiceAccountEnumeration Class
  487. '
  488. ' Enumerate Method
  489. ' - enumerate service accounts on specified computers
  490. ' - the first parameter specifies whether the names are directly specified or
  491. ' the names are contained in the specified file or the names are to be
  492. ' enumerated from the specified domain or ou
  493. ' - the second parameter specifies the account names to be included
  494. ' - the third parameter optionally specifies names which are to be excluded
  495. ' - if specifying NT4 style names for Windows 2000, or greater, domains the name must be
  496. ' preceded with a backslash
  497. ' eg. \NT4Name
  498. '
  499. ' - Note: The source domain and OU will be used if not explicitly specified
  500. '----------------------------------------------------------------------------
  501. ' create instance of service account enumeration object
  502. Set objServiceAccountEnumeration = objMigration.CreateServiceAccountEnumeration
  503. ' enumerate service accounts on specified computers
  504. ' the following are some examples of specifying the names and exclude names
  505. objServiceAccountEnumeration.Enumerate admtData, "CN=Computer1"
  506. objServiceAccountEnumeration.Enumerate admtData, Array("/Computers/Computer3","\Computer4")
  507. objServiceAccountEnumeration.Enumerate admtFile, "C:\Computers.txt", Array("begins_with*","*contains*","*ends_with")
  508. objServiceAccountEnumeration.Enumerate admtDomain, , "C:\ExcludeNames.txt"
  509. '----------------------------------------------------------------------------
  510. ' ReportGeneration Class
  511. '
  512. ' Type Property
  513. ' - specifies the type of report to generate
  514. '
  515. ' Folder Property
  516. ' - specifies the folder where reports will be generated
  517. ' - optional, defaults to Reports folder in the ADMT installation folder
  518. '
  519. ' Generate Method
  520. ' - generate specified report
  521. ' - the option should be admtNone for the admtReportMigratedAccounts,
  522. ' admtReportMigratedComputers, admtReportExpiredComputers, and
  523. ' admtReportNameConflicts reports
  524. ' - the option must be admtData, admtFile or admtDomain for the
  525. ' admtReportAccountReferences report
  526. ' - the include parameter must specify the computers upon which to collect
  527. ' account reference information if the admtReportAccountReferences report
  528. ' is specified
  529. '----------------------------------------------------------------------------
  530. ' create instance of report generation object
  531. Set objReportGeneration = objMigration.CreateReportGeneration
  532. ' generate report
  533. objReportGeneration.Type = admtReportMigratedAccounts
  534. 'objReportGeneration.Folder = "C:\Program Files\Active Directory Migration Tool\Reports"
  535. objReportGeneration.Generate admtNone
  536. 'objReportGeneration.Generate admtDomain + admtRecurse