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?

Answer Summary:
Cancel
1 Comment   [ + ] Show Comment

Comments

  • KHaught. What script are you using to output list of mapped drives?

    Thanks
Please log in to comment

Answers

0
It returns a lot of data, but you could use a custom inventory rule for this also:

ShellCommandTextReturn(net use)
Answered 08/31/2014 by: jknox
Red Belt

Please log in to comment
0

Enter this in your custom field.

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

Answered 05/01/2013 by: dugullett
Red Belt

  • Thanks that did the trick :)
Please log in to comment
0

would love to creat the same report

Answered 05/01/2013 by: brighstarcuit
Seventh Degree Black Belt

  • 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
  • Wow - Incredible wealth of Information in this post - Thank you very much, Dugullett.
Please log in to comment
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

Answered 08/28/2014 by: KHaught
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity