/build/static/layout/Breadcrumb_cap_w.png

Pull list of workstation mapped drives into K1000 inventory

Someone must have accomplished this by now. I don't seem to be able to figure it out, so I thought I would ask. I have a script which runs and puts a text file on the root of C: drive which contains the listing of the mapped drives for each pc. I would like to pull the contents of that text file into a custom inventory field in KACE. Any ideas on how to do so?


1 Comment   [ + ] Show comment
  • KHaught. What script are you using to output list of mapped drives?

    Thanks - anonymous_104535 10 years ago

Answers (4)

Answer Summary:
Posted by: jknox 10 years ago
Red Belt
0
It returns a lot of data, but you could use a custom inventory rule for this also:

ShellCommandTextReturn(net use)
Posted by: dugullett 11 years ago
Red Belt
0

Enter this in your custom field.

ShellCommandTextReturn (cmd.exe /c type C:\Path\to\file\file.txt)


Comments:
  • Thanks that did the trick :) - KHaught 11 years ago
Posted by: brighstarcuit 11 years ago
7th Degree Black Belt
0

would love to creat the same report


Comments:
  • See this. This will get it setup. The report you should be able to get through the GUI. Since the software ID will be unique to your Kbox.

    http://www.itninja.com/blog/view/inventorying-reporting-on-user-profile-specific-other-non-inventoried-data - dugullett 11 years ago
  • Wow - Incredible wealth of Information in this post - Thank you very much, Dugullett. - KHaught 11 years ago
Posted by: KHaught 10 years ago
Senior Yellow Belt
0
PowerOverwhelming - here is the script I run to pull mapped drives. it works on Win 7 and XP  both. We place all of our custom inventory field text files in a folder on C: called KBOX. You can modify this as needed as to where you want the file to go. This script is a conglomeration of info found here and on Google. I didn't write the whole thing, I just made it work for our situation. This script pulls all drive information, not just mapped drives. it pulls your local hard drives and any CD/DVD drives you may have installed also, and the locally logged on user at the time the script was run.
***********************************************************************************************************************************
Dim objFSO, newfolder
Dim strComputer, objWMIService
Dim fso, fsHandle, objShell,LogFileName, colItems, objItem

set objFSO=CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists("c:\KBOX") Then
   newfolder = objFSO.CreateFolder ("c:\KBOX")
End If

Set objShell = CreateObject("Wscript.Shell")
Set fso = Wscript.CreateObject("Scripting.FilesystemObject")

If objFSO.FileExists("c:\KBOX\MappedDrives.txt") Then
fso.DeleteFile "c:\KBOX\MappedDrives.txt", True
End If

LogFileName= "C:\KBOX\MappedDrives.txt"
set fsHandle = fso.OpenTextFile (LogFileName,8,True)

sUser = ConsoleUser(".") ' use "." for local computer

Function ConsoleUser(sHost)
' Returns name of user logged on to console
' If no users are logged on, returns ""
Dim oWMI, colProc, oProcess, sUser, sDomain
Set oWmi = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(debug)}!\\" _
& sHost & "\root\cimv2")

Set colProc = oWmi.ExecQuery("Select Name from Win32_Process" _
& " Where Name='explorer.exe' and SessionID=0")

ConsoleUser = ""
For Each oProcess In colProc
lRet = oProcess.GetOwner(sUser, sDomain)
If lRet = 0 Then
ConsoleUser = sUser
End If
Next
End Function

fsHandle.Writeline Now & " - " _
& "Logged in user:  " & suser _

fsHandle.Writeline "------------------------------------------------------"

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colDrives = objWMIService.ExecQuery _
    ("Select * From Win32_LogicalDisk Where DriveType = 3")
For Each objDrive in colDrives

fsHandle.Writeline objDrive.Name & " " & "Local Hard Drive"

Next

Set colDrives = objWMIService.ExecQuery _
    ("Select * From Win32_LogicalDisk Where DriveType = 5")
For Each objDrive in colDrives

fsHandle.Writeline objDrive.Name & " " & "CD/DVD Drive"

Next


Set colDrives = objWMIService.ExecQuery _
    ("Select * From Win32_LogicalDisk Where DriveType = 4")
For Each objDrive in colDrives

fsHandle.Writeline objDrive.Name & " " & objDrive.ProviderName _

Next

fsHandle.Writeblanklines 1
fsHandle.close

set objShell = Nothing
set fso = Nothing

Don't be a Stranger!

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

Sign up! or login

Share

 
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