Cool Solutions

Importing Computers to Multiple Containers



February 24, 2006 12:00 am





Windows XP Pro SP2, ZENworks 6.5

PROBLEM: Importing computers to more than one container when they are importing based on Selected Container in Import Policy.


  1. Create OU
    In the properties of the OU under the Associated Policy Packages:
    	Users Container Package
    	Service Location Package
    	Users Workstation Package
    NDS Rights:
    	Users Server Package: Workstation Import Policy
    	Users Server Package: Workstation Removal Policy

    You have to edit the vbscript based on your Tree and OUs.
    The computers will be imported based on computer name from the variable pulled from the registry.

  2. Copy text below and paste into notepad, rename to .vbs and save.
  3. After computers import into the OU stated in Import Policy, run this vb script on the computers you want imported into the other OU.
    (Create a ZENworks application of run locally the vbscript)
  4. When the computers are reimaged later they maintain the container because of the Image Safe data on the hard drive.


' This script runs the necessary commands to import computers into
' the designated OU.
' Since the default container on the server import policy is , the
' machine first unregisters itself. A VBS is required as the machine
' name is part of the command required.

Option Explicit

Dim CurrentMachine

Dim WshShell

Dim FullPath

Set WshShell = WScript.CreateObject("WScript.Shell")

CurrentMachine = WshShell.RegRead ("HKLM\System\ControlSet001\Control\ComputerName\ComputerName\ComputerName")

FullPath = "ZWSREG -importws cn=" & CurrentMachine & ".ou=workstations2.ou=zenworks.o=tree"

WshShell.Run("ZWSREG -unreg")

Wscript.Sleep 5000


'I put a return in after each line of the script to show the different lines because of wordwrap in the posting area of the website.
0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

Categories: Uncategorized


Disclaimer: This content is not supported by Micro Focus. It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test it thoroughly before using it in a production environment.