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
213 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
  • 2
  • 2
4 Comments
 
LVL 83

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 83

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

914 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now