Kaseya Community

Script to Find Mapped Drives

  • Does anyone know a way to find mapped network drives on a client computer via scripting? I would like to get a report of who has which drives and what they are mapped to.

    Legacy Forum Name: Script to Find Mapped Drives,
    Legacy Posted By Username: matt@hwgtech.com
  • Use NET USE. Redirect the output to a file in the Kaseya script and then retrieve the file.

    NET USE >c:\temp\mapped.txt

    Greg


    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: gssloan
  • How do I redirect the output to a file? Sorry so clueless, just not familiar with scripting at all

    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: matt@hwgtech.com
  • Hi

    This is not really scripting, but output redirection that has been around since the DOS days...

    NET USE >c:tempmapped.txt

    In the above line the ">" is the redirect command. So the line would execute as net use and redirect the output to the file named "tempmapped.exe" in the current directory on the c drive.

    I would change the line to be: NET USE > c:\tempmapped.txt so that the file is put in a defined location; in this case at the root of the c drive.

    hc





    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: howardc
  • Redirection is performed by just adding the greater than (>Wink symbol and a file name to the end of a command. In Kaseya,if youuse you need to actuallyenter these symbols twice because they are reservedcharacters in Kaseya.

    Here's a script you can run.


    Script Name: Get List of Mapped Drives
    Script Description: This script will get a listing of a computer's mapped drives, create an output file, and retrieve an output file.

    IF True
    THEN
    Execute Shell Command
    Parameter 1 : net use >>c:\temp\mapped.txt
    Parameter 2 : 0
    OS Type : 0
    Get File
    Parameter 1 : c:\temp\mapped.txt
    Parameter 2 : \MappedDrives\mapped.txt
    Parameter 3 : 3
    OS Type : 0
    Delete File
    Parameter 1 : c:\temp\mapped.txt
    OS Type : 0
    ELSE




    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: gssloan
  • Perfect, thanks Greg, that's what I was asking (> vs. >&gtWink. The message was clear, but not understood. You are a gentlemen and a scholar.

    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: matt@hwgtech.com
  • Glad to help.

    Thanks,

    Greg


    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: gssloan
  • Is there a way to have this output go elsewhere other than the Kaseya server? Like to another directory on a different server?

    Legacy Forum Name: Script Requests,
    Legacy Posted By Username: borq646