Hi,
I have the following script below to get the size of a Powerpoint template on a local path and send the size to a log (txt file) on a server share. The script works fine if run locally from the computer the script is on (it sends the file size to the share/file mentioned). But I'm trying to get it to run via a scheduled task using a Group Policy Preference for all users. Unfortunately it doesn't return the file size, it just returns "file size is " (blank). I'm assuming the problem might be that the scheduled task that is set up from Group Policy is run with a domain service account and it cannot find the local path of the powerpoint template file because it's not running under the logged on user context.
Does anybody know if there's any way round this (apart from using logon/logoff or startup scripts)?
call :getFilesize C:\Users\%username%\AppData\Roaming\Microsoft\Templates\Blank.potx
echo file size is %fileSize% >> "\\servername\share\%COMPUTERNAME%.txt"
exit /b
:getFilesize
set filesize=%~z1
exit /b