Kaseya Community

Need script to know mapped drive on a machine

  • Hi,

    Can some one please help me with a script with which I can get to know mapped drive on a machine. Output could be in an email or in a directory on a server. Need to run this on multiple machines at once in a network.
    Kaseya (K2) does not audit mapped drive, hence report will not work on it.

    Any help is highly appreciated

    Thanks in Advance
    Rajeev

    Legacy Forum Name: Need script to know mapped drive on a machine,
    Legacy Posted By Username: rajeevsharma
  • rajeevsharma
    Hi,

    Can some one please help me with a script with which I can get to know mapped drive on a machine. Output could be in an email or in a directory on a server. Need to run this on multiple machines at once in a network.
    Kaseya (K2) does not audit mapped drive, hence report will not work on it.

    Any help is highly appreciated

    Thanks in Advance
    Rajeev


    Search the scripts section someone posted one months ago

    Legacy Forum Name: How-To,
    Legacy Posted By Username: thirteentwenty
  • Basics of the script would be as follows ....

    command prompt net use >> c:\mapped.txt

    Then get the mapped.txt file using get file or have it email you the contents of the file

    This will give you what you are looking for.

    Legacy Forum Name: How-To,
    Legacy Posted By Username: TBK Consulting
  • I was just working on this. When I do the

    net use >> c:\mapped.txt

    then the resulting file contains:

    New connections will be remembered.

    There are no entries in the list.


    However, if I actually run the command on the machine itself:

    net use > c:\drives.txt

    Then the resulting file contains:

    New connections will be remembered.


    Status Local Remote Network

    -------------------------------------------------------------------------------
    OK Y: \\tcf01\Business\scanned images
    Microsoft Windows Network
    OK \\tcf01\Business Microsoft Windows Network
    OK \\tcf01\SugarSync Microsoft Windows Network
    OK \\tcf01\TCF Clients Microsoft Windows Network
    OK \\tcf01\IPC$ Microsoft Windows Network
    The command completed successfully.


    So, I don't get it. I know that in Kaseya it has to use the double >> rather than the single, but the output is different!

    Legacy Forum Name: How-To,
    Legacy Posted By Username: lukem@thecomputerfactory.com
  • put it in a batch file, send the batch file to the machine and then execute the batch file and then recover the results file, and then delete everything left ...

    Legacy Forum Name: How-To,
    Legacy Posted By Username: TBK Consulting
  • Are the drives being mapped during a user login? If so, you'll have to run this as that user when they are logged in. Otherwise you will get the results of what the "System" has mapped.

    Legacy Forum Name: How-To,
    Legacy Posted By Username: rfouche
  • Yes drive are mapped when a user login...

    Legacy Forum Name: How-To,
    Legacy Posted By Username: rajeevsharma
  • I came up with this today - works well Smile
    (Note: lynxtemp is teh name given to our Agent Temp Folder in Get Variable)

    Script Name: Net Use Local Drives
    Script Description: [Geoff@macnamara.it]
    Write mapped drives to a file and e-mail to

    IF User Is Logged In
    Parameter 1 :
    THEN
    Get Variable
    Parameter 1 : 10
    Parameter 2 :
    Parameter 3 : lynxtemp
    OS Type : 0
    Execute Shell Command
    Parameter 1 : echo %username% >> #lynxtemp#\username.log
    Parameter 2 : 0
    OS Type : 0
    Get Variable
    Parameter 1 : 6
    Parameter 2 :
    Parameter 3 : machineid
    OS Type : 0
    Get Variable
    Parameter 1 : 1
    Parameter 2 : #lynxtemp#\username.log
    Parameter 3 : username
    OS Type : 0
    Execute Shell Command
    Parameter 1 : net use >> #lynxtemp#\netuse.txt
    Parameter 2 : 0
    OS Type : 0
    Get Variable
    Parameter 1 : 1
    Parameter 2 : #lynxtemp#\netuse.txt
    Parameter 3 : netuse
    OS Type : 0
    Send Email
    Parameter 1 : support@lynxcomputing.com
    Parameter 2 : Local Drive Mappings for #username#on #machineid#
    Parameter 3 : #netuse#
    OS Type : 0
    Write Script Log Entry
    Parameter 1 : List of local drives was sent to Support
    OS Type : 0
    ELSE



    It gets the logged on user's name and the machine ID. We use different drive mappings for different users, so good to know who is logged on. The User Name and machine ID are shown in teh E-mail Subject, and the output in the body.

    Legacy Forum Name: How-To,
    Legacy Posted By Username: geoff@lynxcomputing.com
  • Is there an updated version of this script for 6.2?  We'd like to get mapped drives on endpoints.  How is everyone else doing this?

  • The script should work, I still use the original one.  be mindful of the spaces