KACE Product Support Question

Custom Inventory Rule to List Mapped Network Drives

08/25/2016 1883 views

I am writing a Custom Inventory Rule to list the mapped network Drives of a Node. I have used both of the following rules:

ShellCommandTextReturn(cmd /c net use )


ShellCommandTextReturn (cmd /c wmic logicaldisk get caption,description,drivetype,providername,volumename)

Both seem to work. Problem is both return the output from an adminstator shell and not a regular shell.

Output from "ShellCommandTextReturn(cmd /c net use )" :

"New connections will be remembered.

There are no entries in the list."

Output from "ShellCommandTextReturn (cmd /c wmic logicaldisk get caption,description,drivetype,providername,volumename)":

"Caption Description DriveType ProviderName VolumeName
C: Local Fixed Disk 3 "

Desired Results:

ShellCommandTextReturn(cmd /c net use )

Status       Local     Remote                    Network

OK           S:       
\\someserver\software       Microsoft Windows Network
OK           U:       
                                                Microsoft Windows Network
Disconnected X:       
\\someserver\somename         Microsoft Windows Network
\\someserver\somename Microsoft Windows Network

ShellCommandTextReturn (cmd /c wmic logicaldisk get caption,description,drivetype,providername,volumename)

Caption  Description         DriveType  ProviderName                     VolumeName
C:       Local Fixed Disk    3
S:       Network Connection  4         
\\someserver\software              Some Volume 3
U:       Network Connection  4         
\\someserver\somefolder\somename  Some Volume 1
X:       Network Connection  4         
\\someserver\somename              New Volume 2

Any suggestions or a different approach such and exporting the output from the registry appreciated.

Answer Summary:
0 Comments   [ + ] Show comments


Answer Chosen by the Author

Like Chuck said CIR's run as system and network drives are a user thing.  You need to create a Kscript that creates a txt to have the cir read for this to work.

Here is a script of mine that gathers user based info for CIR's to read.

Here is the batch file it runs
wmic logicaldisk where "drivetype='4'" get deviceid,providername > C:\ProgramData\Dell\KACE\user\NetworkDrives.txt

wmic printer where 'network="true"' get name, default, network > C:\ProgramData\Dell\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\Dell\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\Dell\KACE\user\AllPrinters.txt

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

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

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

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

c:\windows\system32\reg.exe query "HKCU\Software\Shoreline Teleworks\ShoreWare Client" /v server > C:\ProgramData\Dell\KACE\user\shoretell.txt

You then create CIR's to read the text files

Answered 08/29/2016 by: SMal.tmcc
Red Belt

Community Chosen Answer

The issue is that custom inventory rules run in the system context and the drives are mapped in the user context. The other issue is that these values will get updated every time the computer updates it's inventory, so if the computer updates inventory when no user is logged in, then your data won't be accurate.

Answered 08/26/2016 by: chucksteel
Red Belt

All Answers

You might be able to adapt the script from the following link. Place it in the programdata\dell\kace folder and call it from the CIR.


Answered 08/27/2016 by: flip1001
Black Belt

Don't be a Stranger!

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

Sign up! or login


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