Novell Home

Importing Computers to Multiple Containers

Novell Cool Solutions: Tip
By Robert Viou

Digg This - Slashdot This

Posted: 24 Feb 2006
 

ENVIRONMENT:
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.

Solution

  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.

Script

' 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

WshShell.Run(FullPath)

'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.


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell