Groupe des Utilisateurs Altiris Suisses et Francophones Group

 View Only
  • 1.  Script to change server IP adress in client agents

    Posted Feb 07, 2011 03:20 AM

    Hi all,

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



  • 2.  RE: Script to change server IP adress in client agents

    Posted Feb 09, 2011 10:34 AM

    It is particulary usefull, when the older DS 6.9 server is not answering any more correctly, because not able to change.

    Also usefull when the old 6.9 down, and an old PC switch up later on...

    The script should be installed in the machine login script.

    Nice information Yannick, you can publish as a "Blog" because not a Forum question (as it is the solution!)

    If you extend a litlle, explaining how to publish this script into the AD correctly to make this login script operating each PC the domain when computer boot, you can probably create a nice Article, instead of a simple Blog :)

    Best regards.



  • 3.  RE: Script to change server IP adress in client agents

    Posted Feb 10, 2011 06:52 AM

    Hi Pascal,

    I've created an article named as this forum entry. Waiting for admin approval :-)

    Hope this will be enough complete to help ;-)

    Best regards.

    Yannick.