As of 23.08.2023 NWC Services GmbH has become CANCOM GmbH. Please feel free to visit us at www.cancom.com
Toggle Bar

BLOG

BLOGGING CONSULTANTS

NWC Services Blog

Blogs von Consultants der NWC Services GmbH

NCP/ICDB via GPO aktualisieren

Ab und wann entsteht mal die Situation, dass die NCP Dateien der NI/enteo/DSM Infrastruktur auf allen Clients aktualisiert werden muss. Dieser Fall kann beispielsweise durch eine falsche Konfigurationseinstellung, falsch konfigurierte Virenscanner, Festplatten-/ Verschluesselung oder Komprimierung entstehen.

 

Je nach Konfiguration (keine Ausfallsite, etc.) "finden" die Clients dann Ihre Depots nicht mehr wieder. Als Workaround bietet sich es sich an, die korrekten NCP Dateien via GPO EINMALIG zu verteilen. Zu diesem Zweck wird ein Computerseitiges Startup Script erstellt, und folgende Batch Datei uebergeben:

---------------------------------------------------------------------------------------------------------------

::@echo off
:: Define value to test this script more than one time
set _count=1
:: Define source path for NCP files
set _ncpSource=\\myServer\SysVol\MyDomain\Policies\{ACE2726B-DED7-48DD-AEF5-521B860B84BE}\Machine\Scripts\Startup

:: Get a special regkey to detect something special on the client (optional)
reg.exe query hklm\software\Wow6432Node\MyKey /v targetEnvironment | find "01"
if %errorlevel%==0 goto :eof

:: Do the same as before, but in x64 hive
reg.exe query hklm\software\MyKey /v targetEnvironment | find "01"
if %errorlevel%==0 goto :eof

:: Get the correct targetpath for the NCP files
if exist "%ProgramFiles(x86)%\netinst\NiCfgLcl.ncp" set targetPath=%ProgramFiles(x86)%\netinst
if exist "%ProgramFiles%\netinst\NiCfgLcl.ncp" set targetPath=%ProgramFiles%\netinst

:: Exit script, if script runs before
if exist "%targetPath%\ncpUpdate%_count%.flg" goto :eof

:: Exit script, if NetInstall 5 client
if exist "%targetPath%\NiAiServ.exe" goto :eof

if not "%targetPath%"=="" (
 :: Copy new files to client (They must be named="NiCfgLcl_New.ncp" and "NiCfgSrv_New.ncp" in the source directory)
 copy "\*.ncp" "%targetPath%" /B /V /Y

 :: Rename existing files
 move "%targetPath%\NiCfgLcl.ncp" "%targetPath%\NiCfgLcl_Old.ncp"
 move "%targetPath%\NiCfgSrv.ncp" "%targetPath%\NiCfgSrv_Old.ncp"

 :: Rename new files to corerct name
 move "%targetPath%\NiCfgLcl_New.ncp" "%targetPath%\NiCfgLcl.ncp"
 move "%targetPath%\NiCfgSrv_New.ncp" "%targetPath%\NiCfgSrv.ncp"

 :: Report date and time to flag-file
 echo %date% - %time% >> "%targetPath%\ncpUpdate%_count%.flg"
)

---------------------------------------------------------------------------------------------------------------

Hinweis: Diese Batch Datei ist nur ein Template und sollte gemaess den Gegebenheiten modifiziert und getestet werden.

×
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

Installieren eines selbst signierten Treibers
Computertyp in DSM

Related Posts

 

Comments

No comments made yet. Be the first to submit a comment
Already Registered? Login Here
Friday, 26 April 2024

Captcha Image

Consulting Services: