Groupe des Utilisateurs Altiris Suisses et Francophones Group

 View Only

Script to Change Server IP Address in Client Agents // DS 6.9 

Feb 11, 2011 01:25 PM

A few days ago we did migrate our DS6.9 on a new server. The DB was created, all the entries on the old server have been exported from the old to the new server (jobs, scripts, etc...)

But what about the clients? We have approximately 1500 clients and we wouldn't uninstall and reinstall the agent on each computer; so I've done a little script to change the server IP on the client side:

 @echo off
REM ======================================================================
REM
REM Batch File -- Created with SAPIEN Technologies PrimalScript 2007
REM
REM NAME:
REM
REM AUTHOR: Yannick Racheter , Figeas
REM DATE  : 31.01.2011
REM
REM COMMENT:
REM
REM ======================================================================
Set AppsName=Altiris_REG_MOD
Set NetLogPath=\\SERVER\LOGS\%AppsName%
Set LocLogfile=PATH_TO_LOG\LOGS\Altiris_reg_mod_services_restart.log
Set NetLogfile=%NetLogPath%\%computername%.log
REM subst P: C:\temp
REM ======================================================================
REM Recupere date du jour et Heure
REM ======================================================================
for /f "tokens=1-4 delims=. " %%a in ('date /t') do (
  set mjour=%%a
  set mmois=%%b
  set mannee=%%c
)
set mydate=%mannee%%mmois%%mjour%

for /f "tokens=1-2 delims=: " %%a in ('time /t') do (
  set heure=%%a
  set minute=%%b
)
set mytime=%heure%%minute%
@REM if exist "C:\ASSACMDS\LOGS\Altiris_reg_mod_services_restart.log" goto :EOF

REM ======================================================================
REM Check registry value
REM ======================================================================
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Client Service" /v "TcpAddr" | findstr 176.30
IF %ERRORLEVEL% == 0 GOTO END_LOG
REM ======================================================================
REM verfification de la valeur de registre Version
REM ======================================================================
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Client Service" /v "TcpAddr" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Client Service" /v "TcpAddr" /t REG_SZ /d "192.168.176.30" /f
if %ERRORLEVEL% == 0 @ECHO %Date% / %TIME% - "REG Modifiée ip = 176.30" >>%LocLogfile%
REM ======================================================================
REM Redémarrage du service
REM ======================================================================
net stop "Service Client Altiris"
net start "Service Client Altiris"
if %ERRORLEVEL% == 0 @ECHO %Date% / %TIME% - "Service Altiris Deployment Agent redémarré" >>%LocLogfile%
net stop "Altiris Deployment Agent"
net start "Altiris Deployment Agent"
if %ERRORLEVEL% == 0 @ECHO %Date% / %TIME% - "Service Altiris Deployment Agent redémarré" >>%LocLogfile%
net stop "Altiris Client-Dienst"
net start "Altiris Client-Dienst"
if %ERRORLEVEL% == 0 @ECHO %Date% / %TIME% - "Service Altiris Deployment Agent redémarré" >>%LocLogfile%
net stop "Altiris Client Service"
net start "Altiris Client Service"
if %ERRORLEVEL% == 0 @ECHO %Date% / %TIME% - "Service Altiris Deployment Agent redémarré" >>%LocLogfile%
GOTO LOG_COPY
REM ======================================================================
REM Logging
REM ======================================================================
:END_LOG
@ECHO %Date% / %TIME% - "La valeur du registre contient déjà le serveur 176.30" >>%LocLogfile%
:LOG_COPY
::Copy /Y %LocLogfile% %NetLogfile%
@ECHO %Date% / %TIME% - "La valeur du registre contient déjà le serveur 176.30" >>%NetLogfile%
:EOF 

We did integrate this batch at the logon script. It have been useful to retrieve all the clients on the new server in a few hours (every logon did rietrieve the client into the new server).

Here's how we did integrate it to the logon via GPO.

- On an admin computer, go to "Start Menu" => "Execute" and type "gpmc.msc"

- Once the console is open, browse to Group Policy Object (objet de stratégie de groupe); right click on it and choose "New"

  

- Insert the name of your strategy in the "Name:" field and let the default choice "(none)" in the "Object Starter GPO Source:" field

- Once your GPO has been created, richt click on it and choose "Modify..."

- The GPEdit (Editeur de gestion des stratégies de groupe) appears

- Browse "Computer configuration" => "Strategies" => "Windows settings" => "Scripts" and double click on "Start"

  

- In the new window, choose "Scripts" tab and click "Add...", then browse your computer (or server) to find the desired batch, and then click OK.

- Once done, go back on your policy and check if everything is as you wish:

  • - Check if the object is active and / or linked
  • - Add desired Users or Groups in the "Security Filtering" area

- Then go to the "Parameters" tab where you can check if your Policy is well configured at all.

  

That's all folks ;-)

If you have comments or suggestions, they are welcome!

Thanks for reading.

Hope it will help!

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Mar 10, 2011 06:49 PM

This above (select all, production agent, ...)  is exactly what I have done in the past. This will only move the computers over that are connected to the old Altiris server. It works really well before you kill the old DS server.

Mar 05, 2011 06:09 PM

If you manage 100 clients, it is OK, if having 1'000 or more, you can be sure you will got some missing...

This method ensure all "Domain computer" got the agent, all the same missing the DS agent before, or a failed DS agent before...

and should  all the same verify, not missing some :)

Feb 16, 2011 09:42 AM

We didn't proceed like that because we wanted to retrieve every "real, clean" computer in our domain.

With the old DS we had a lot of garbage and it was not interesting to retrieve it in the new DS.

Feb 15, 2011 01:38 PM

How about select all computers in the current DS, right click and choose "Change Agent Settings -> Production Agent and then change the IP in there.

 

Related Entries and Links

No Related Resource entered.