/build/static/layout/Breadcrumb_cap_w.png

trying to remove / see if a specific file from users desktops

tried to make a Online Kscript to verify a file exist.
Run as Logged-in user
    Verify a file exisits
        Directory: c:\users\%username%\desktop
        File: FILENAME.EXE

in the status log I get:
    File does not exist: c:\users\comp-123$\desktop\FILENAME.EXE

instead of the logged in username i am getting the computer name with a $.
Should %username% work?


2 Comments   [ + ] Show comments
  • I made a further test...
    I added a step to execute the following batch
    SET > Myfile.txt
    The interesting fact is that it seems that the Verify File action is impersonating the computer account while the Execute Batch in the remediation phase is impersonating the right user (all the environment variables were right there).
    I will investigate a bit more....
    Kind regards,
    Marco - StockTrader - StockTrader 8 years ago
  • I am having same problem...any update on how to resolve? - bnerison 8 years ago

Answers (4)

Posted by: JasonEgg 7 years ago
Red Belt
0
How about using %USERPROFILE%\Desktop instead of c:\users\%username%\desktop ?
Posted by: JasonEgg 7 years ago
Red Belt
0
These settings worked for me:


If you're still having problems, consider posting the XML of your current kscript (click on the "Edit XML" button, right above the "Dependencies" heading)
Posted by: CraigT 8 years ago
Orange Belt
0
If you are getting the desktop name instead of the actual username it means that the action is being executed as SYSTEM instead of the logged in user.

Comments:
  • I have the option to run as Logged-in user checked. - kroosevelt 8 years ago
  • This is only evident with 6.4 agents, works fine on 6.0 agent machines. - bnerison 7 years ago
Posted by: chucksteel 8 years ago
Red Belt
0
I have had issues in the past with getting KACE to run as the logged in user. You could use this command to get the current logged in user:
for /f "tokens=8" %%a in ('tasklist /v ^|find "explorer.exe"') do (
set "user=%%a")

That will set the user variable to the current user and you can use that to delete the file. You would use this in a shell script, not a KScript.


Comments:
  • I tried this shell script but get error - Run As Console Logged in user failed: No User logged in to console however I am logged into the machine I am running it on. Please help, thanks! - bnerison 7 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ