Copying files to System32 w/ Scripting
At a loss, hoping someone can see what I am doing wrong. I just want to copy .ico files to C:\Windows\System32 on all machines in my district. I've ran into issues using KACE scripts trying to do this. The task I've been given is to update desktop shortcuts that reside in C:\Users\Public\Desktop. I need to first copy the shortcut's .ico files to system32 (because once the desktop shortcut .url is copied to C:\users\public\desktop it loses its picture and is looking in system32 for the .ico file). I even created new shortcuts and had their picture point to a network location that's global \\servername\DesktopIcons and that still doesn't work. When KACE tries to copy the shortcut files, the pictures sometimes don't come over, it's very sporadic and the logs aren't really helpful as to why this happens. Quest support has stated that working on icon files "is out of their realm of support" even though clearly putting this into KACE is where it stops working... so I am at a loss, I've been trying to get this to work for 3 days now and have been unsuccessful I'm not sure why copying desktop shortcuts is so difficult with the SMA. I can't use the desktop shortcut feature in Configuration Policies either because there is no option for the desktop icon. We are a k-12 school so it's imperative that the icon appears with the internet shortcut for easy identification to children. I tried the File Synchronization feature as well but since these are desktop icons and not software packages I really don't think that would work either. I've read through the usage of robocopy and xcopy but still having issues using the 2 (only with KACE, works fine locally). There are 5 shortcuts altogether but only 2 that need to be updated.
If I run this locally (pretty much all of this ran locally works fine), it works great. Once it's in KACE and ran as local system, it does nothing. I also tried running it through KACE with domain admin credentials and it still won't work (presumably because they do not have access to system32?):
First step, copy .ico files to system32, have tried multiple different ways:
tried: robocopy \\SERVERNAME\DesktopIconTest\DesktopIcons\Icons C:\windows\system32 classlink.ico Destiny.ico "Genesis Login.ico" Gmail.ico SchoolDude.ico - this works ran locally, does not work when ran in a Kscript as local admin nor domain admin
tried: xcopy /Y "%~dp0\Icons\*" "C:\Windows\System32"
tried: Selected "run a batch file" as a Remediation Task and copied both of those ^ into here. Also saved a .bat file and ran from \\SERVERNAME\. Also saved as a .bat file and uploaded as a dependency and than ran it like $(KACE_DEPENDENCY_DIR)\CopyItems.bat
Second Step, Remove the old shortcuts and copy the new ones:
tried: cd C:\users\public\desktop
del "Technology Help Desk.url"
xcopy /Y \\SERVERNAME\DesktopIconTest\DesktopIcons\ClassLink.url "C:\users\public\desktop"
xcopy /Y "\\SERVERNAME\DesktopIconTest\DesktopIcons\Technology Help Desk.url" "C:\users\public\desktop" - works when ran with domain admin credentials
tried: xcopy /Y "SchoolDude.ico" "C:\Windows\System32"
xcopy /Y "Technology Help Desk.url" "c:\users\public\desktop" - combination of the first task and also copies the shortcut
tried: xcopy /Y "classlink.ico" "C:\Windows\System32"
xcopy /Y "classlink.url" "c:\users\public\desktop" - combination of the first task and also copies the shortcut
At this point I guess that I am looking for a method to this madness, maybe I am over complicating it. I'm not really sure why I can't just copy the .url files to the public user's desktop and be done with this like I have done in the past with Kscripts. Any help or resources would be super appreciated, willing to try anything at this point. Thanks
Log for !2020 Desktop Shortcuts - 12/20/19 TEST on RSD-SURF-03 [ Show All ]
|Elapsed Time:||1 second|
Running with credntials provided: domain [DOMAINNAME] user [KACEService] Creating process returned non-zero: C:\ProgramData\Quest\KACE\
kbots_cache\packages\kbots\ 739\CopyItems.bat : (0) The operation completed successfully. Error Code: 0 Status Code: 1
verify - on_verify_success verify - on_verify_failure verify - launch_program Launching program: 'C:\ProgramData\Quest\KACE\
kbots_cache\packages\kbots\ 739\CopyItems.bat' '' wait='true'
Running kbot: runkbot 739 1576858558 KBotScript::LogScriptInfo - Start id=739 name=!2020 Desktop Shortcuts - 12/20/19 TEST version=1576858558 type=policy execute disconnected=false logged_off=true execute events KBotScript::LogScriptInfo - Finish KBotScript::LogScriptInfo - Start id=739 name=!2020 Desktop Shortcuts - 12/20/19 TEST version=1576858558 type=policy execute disconnected=false logged_off=true execute events KBotScript::LogScriptInfo - Finish KBotScriptManager::
CleanupDependencies - clean up dependencies in kbot directory C:\ProgramData\Quest\KACE\ kbots_cache\\packages\kbots\ 739\ CleanupDependencies: file CopyIcons.bat is part of the dependency list, keep the file runkbot ----- launching [path='C:\ProgramData\Quest\ KACE\kbots_cache\packages\ kbots\739' program='CopyItems.bat' parms='' wait='true'] -----