Kaseya Community

Delete file under user's profile startup folder.

  • Hey guys !!

    I need to delete a file that we manually placed on the startup of every user profile in a network.

    The main idea is create a script that deletes "filetodelete.txt" from the
    users Start-up folder
    \\Start Menu\Programs\Startup\filetodelete.txt

    Ideas ??

    Thanks !!

    Legacy Forum Name: Delete file under user's profile startup folder.,
    Legacy Posted By Username: christian@syneteksolutions.com
  • If the file has a unique name, you can use the VBScript to locate the file and delete it if it exists.

    Samples of VBScripts searching for files:
    http://www.visualbasicscript.com/m_43739/mpage_1/key_/tm.htm#43739

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Lmhansen
  • Thanks for the quick reply...

    Yes it has an unique name what it doesn't have is an unique location because every user has a different name so you will have C:\Documents and Settings\chris; C:\Documents and Settings\joe...

    I think I need to verify who is logged into the pc and some way attach it to a variable and then proceed to find the folder and delete file.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: christian@syneteksolutions.com
  • vbscript:
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    UserName = WshNetwork.UserName
    path = "c:\Documentes and Settings\" & UserName & "\..."

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Lmhansen
  • christian@syneteksolutions.com

    I think I need to verify who is logged into the pc and some way attach it to a variable and then proceed to find the folder and delete file.


    There's already a variable:

    %userprofile%\Start Menu\Programs\Startup would give you the Startup folder for the currently logged in user.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: RCS-Michael
  • Great Thanks !!!

    I'll give this a try !!!

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: christian@syneteksolutions.com