/build/static/layout/Breadcrumb_cap_w.png

Custom Inventory Rule to collect Map Drives

Hello everyone,

Does anyone had tried to create a custom inventory rule for SMA  or something similar to collect that Map Drives names\shares?

this will become handy in case we need to look back and reconnect users after redoing their computers. Our environment does not have computers joined to the domain.

I'm trying to integrate something and get results like from this page:

https://stackoverflow.com/questions/4889026/recover-disconnected-mapped-drive


any tip will help,

Thank you!



2 Comments   [ + ] Show comments
  • net use >C:\Install\Scripts\Drives.txt - AFCUjstrick 5 years ago
    • If you run that as a CIR it will run as system and not work. Mapped drives are a users item not a machine item, so you must query for them as the user. - SMal.tmcc 5 years ago
      • Yes sir, we run it as a script and then use the Custom Inventory to pull the text file it creates. - AFCUjstrick 5 years ago
  • The return you are getting are the SYSTEMS mapped drives not the USERS. Yes you get a return but it is not true. If you go to the computer and open a command window as the user you will see different results then what you see in the CIR return. You need to run the command as the user and the only way to do that in the SMA is thru Kscripts. - SMal.tmcc 5 years ago
    • a quick way to see this is login as a user that has mapped drives. Open a cmd as that user and one as administrator. run the net use in both windows - SMal.tmcc 5 years ago

Answers (1)

Answer Summary:
Posted by: SMal.tmcc 5 years ago
Red Belt
2

Top Answer

Mapped drives are a user function.  You need to use a kscript that runs a logged in user and runs every few hours (custom schedule 0 10,12,14,16 * * 1,2,3,4,5) to collect the information in text files you then read with CIR's  I use a online shell script

wmic logicaldisk where "drivetype='4'" get deviceid,providername > C:\ProgramData\quest\KACE\user\NetworkDrives.txt

wmic printer where 'network="true"' get name, default, network > C:\ProgramData\quest\KACE\user\NetworkPrinters.txt

wmic printer where "network=false and NOT DriverName LIKE '%%WebEx%%' and NOT DriverName LIKE '%%Amyuni%%' and NOT DriverName LIKE '%%Microsoft%%' and NOT DriverName LIKE '%%PDF%%' and NOT DriverName LIKE '%%Adobe%%' and NOT DriverName LIKE '%%Hyland%%' and NOT DriverName LIKE '%%snagit%%'" get name,drivername,printerstatus > C:\ProgramData\quest\KACE\user\LocalPrinters.txt

wmic printer where "NOT DriverName LIKE '%%WebEx%%' and NOT DriverName LIKE '%%Amyuni%%' and NOT DriverName LIKE '%%Microsoft%%' and NOT DriverName LIKE '%%PDF%%' and NOT DriverName LIKE '%%Adobe%%' and NOT DriverName LIKE '%%Hyland%%' and NOT DriverName LIKE '%%snagit%%'" get name,drivername,portname > C:\ProgramData\quest\KACE\user\AllPrinters.txt

c:\windows\system32\reg.exe query hkcu\software\microsoft\windows\currentversion\run /s > C:\ProgramData\quest\kace\user\hkcuRunKeys.txt

c:\windows\system32\reg.exe query HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\PublishingWizard\AddNetworkPlace\AddNetPlace\LocationMRU > C:\ProgramData\quest\kace\user\hkcuNetplace.txt

c:\windows\system32\reg.exe query hkcu\software\microsoft\windows\currentversion\uninstall /s /f DisplayName > C:\ProgramData\quest\KACE\user\hkcuSoftware.txt

c:\windows\system32\reg.exe query hkcu\software\wow6432node\microsoft\windows\currentversion\run /s > C:\ProgramData\quest\KACE\user\hkcuRunKeysx64.txt

c:\windows\system32\reg.exe query hkcu\software\wow6432node\microsoft\windows\currentversion\uninstall /s /f DisplayName > C:\ProgramData\quest\user\hkcuSoftwarex64.txt

dir %temp%\*.exe > C:\temp\exes.txt

The name of the output text files tells what each call does.

You create CIR's to read the files.

Example:

Shellcommandtextreturn(cmd /c if exist C:\ProgramData\quest\kace\user\hkcuNetplace.txt type C:\ProgramData\quest\kace\user\hkcuNetplace.txt)






Comments:
  • Thanks, SMal.tmcc!

    Man...I was so far away from how it supposed to be done, I'm now able to see that info that I was looking for.

    Thanks again! - horacior 5 years ago
  • Getting an error on Windows 10 with the first line:
    wmic logicaldisk where "drivetype='4'" get deviceid,providername > C:\ProgramData\quest\KACE\user\NetworkDrives.txt

    CMD and PS both return "No Instance(s) Available." error and the file is not created. - JS_DC 5 years ago
    • Are you running the script as logged on user? if you run as administrator or the default of system it will give that result. - SMal.tmcc 5 years ago
      • Ah, thanks! Was running locally in CMD/Powershell (as admin...) for testing and that caused the error. Non admin worked properly. - JS_DC 5 years ago
 
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