Solved

How can I bundle/package up and deploy a .HTM, .NTK, and .DLL file to 400 Windows 7 machines?

Posted on 2015-02-02
4
223 Views
Last Modified: 2015-02-05
How can I bundle/package up and deploy a .HTM, .NTK, and .DLL file to 400 Windows 7 machines?

Problem:  We have 400 KIOSK with Windows 7 OS on it that recently had some technical issues. The Netkey support technician was able to fix the issues, and we tested it with one Kiosk. It works! The support tech updated a .HTM, .NTK, and .DLL file on the machine.

Deployment Method: The question is how do we deploy the fix to 400 machines? We need to find a method were we can deploy the newly updated  .HTM, .NTK, and .DLL file to it’s current directory. In turn, we need a way to where the current file (which will be replace by the updated file) will get renamed to .old. Can this be achieved by PSEXEC, script, .BAT,  GPO? If we can accomplish this, please detail step-by-step example on how this can be done using the example in the screenshot, with the directory path as indicated. Thank you.

Here is what we want accomplished (see screenshot).
File Replacement
0
Comment
Question by:joukiejouk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 84

Accepted Solution

by:
oBdA earned 500 total points
ID: 40585682
You can do that with a GPO and a startup script applied to the machines in question.
Note: if UAC is active, you might get a prompt to change the permissions when accessing the netlogon folder; instead of changing the permissions, use either a command/powershell prompt started elevated to copy the files, or use a third-party Explorer you can start elevated (you can't run Windows Explorer elevated). Personally, I like Explorer++ (https://explorerplusplus.com/) for that, because it doesn't require installation.
* In the netlogon share on your DC (usually C:\Windows\SYSVOL\domain\scripts, or connect from a client to \\<SomeDC>\netlogon), create a folder "Big5Kiosk_v4".
* Put the files you want to copy into this folder.
* Save the script below as Big5Kiosk.cmd directly in the netlogon folder (not in the Big5Kiosk_v4 folder);  in line 3, change the domain name to your domain's FQDN, and in line 4, change/add the file names to copy.
* Move a test machine into a test OU, create a new GPO "Big5Kiosk" or whatever, and link it to that OU.
* Edit the GPO, and go to "Computer Configuration\Policies\Windows Settings\Scripts (Startup/Shutdown)
* Right-click "Startup" and choose "Properties".
* Click "Add", and enter "\\<your.domain.fqdn>\netlogon\Big5Kiosk.cmd as Script Name (do NOT use the "Browse" dialog).
* Reboot the test client.
* If everything went OK, you should find the new files in the target folder; you can then either add some more test clients to the test OU, or link the GPO to the OU(s) with the rest of the clients and reboot those as well.
If the new files aren't there, check the log file "C:\Windows\Temp\Big5Kiosk.log".
If the log file isn't there, check the System event log for errors applying the GPO.
You can use the same script to revert to the old files, or apply another update; just replace the files in the netlogon\Big5Kiosk folder and reboot the clients again.
@echo off
setlocal enabledelayedexpansion
set DomainFqdn=your.domain.fqdn
set CopyFiles="nkscripts.htm" "NKVolCrtl.dll"
set SourceFolder=\\%DomainFqdn%\netlogon
set TargetFolder=C:\Big5Kiosk_v4\bin

set LogFile=%Systemroot%\Temp\%~n0.log
>"%LogFile%" echo %~nx0 started at %Date% %Time%
if not exist "%TargetFolder%" (
	>>"%LogFile%" echo ERROR: Target folder '%TargetFolder%' not found!
	goto Done
)
for %%a in (%CopyFiles%) do call :Process "%%~a"
>>"%LogFile%" echo %~nx0 finished at %Date% %Time%
goto :eof

:Process
>>"%LogFile%" echo Processing '%~1' ...
if not exist "%SourceFolder%\%~1" (
	>>"%LogFile%" echo ERROR: Source file '%SourceFolder%\%~1' not found!
	goto :eof
)
for %%a in ("%SourceFolder%\%~1") do set SourceDate=%%~ta
if exist "%TargetFolder%\%~1" (
	for %%a in ("%TargetFolder%\%~1") do set TargetDate=%%~ta
	if "!SourceDate!"=="!TargetDate!" (
		>>"%LogFile%" echo ... skipped, found in the same version.
		goto :eof
	) else (
		set TimeStamp=!TargetDate: =_!
		set TimeStamp=!TimeStamp:/=!
		set TimeStamp=!TimeStamp::=!
		set TimeStamp=!TimeStamp:.=!
		set BackupFile=%~1.!TimeStamp!.old
		if exist "%TargetFolder%\!BackupFile!" (
			>>"%LogFile%" echo ... changed version, backup file already exists: reverting to previous version ...
		) else (
			>>"%LogFile%" echo ... changed version, renaming existing file to '!BackupFile!' ...
			ren "%TargetFolder%\%~1" "!BackupFile!" >>"%LogFile%" 2>&1
			if errorlevel 1 (
				>>"%LogFile%" echo ERROR: failed to rename!
				goto :eof
			)
		)
	)
)
>>"%LogFile%" echo ... copying '%SourceFolder%\%~1' to '%TargetFolder%' ...
copy "%SourceFolder%\%~1" "%TargetFolder%" >>"%LogFile%" 2>&1
if errorlevel 1 (
	>>"%LogFile%" echo ERROR: failed to copy!
	goto :eof
)
>>"%LogFile%" echo ... OK.
goto :eof

Open in new window

0
 

Author Comment

by:joukiejouk
ID: 40590413
Hello,

I followed your steps but to no avail. Please see my screenshot and if something does not look right, let me know.

1. I made some edits to your script and applied it to my environment.
script correction
2. My GPO Config on a DC.
gpo config
gpo config 2
3. From client machine
client machine
client error log
0
 
LVL 84

Expert Comment

by:oBdA
ID: 40590458
You're nearly there, the missing part is my bad, sorry.
In Line 5, SourceFolder is missing the subfolder with the files (and you can leave %DomainFqdn% as it is), so it needs to be
set SourceFolder=\\%DomainFqdn%\netlogon\Big5Kiosk_v4

Open in new window

0
 

Author Comment

by:joukiejouk
ID: 40592583
Can this be done through PSEXEC? If so, can you detail the steps?
0

Featured Post

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
Resolve DNS query failed errors for Exchange
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question