Page 1 of 3 123>
Topic Options
#141862 - 2005-06-16 09:34 PM Drive Mapping Capture
jhdvy Offline
Fresh Scripter

Registered: 2002-03-22
Posts: 44
Loc: New Jersey
Is there a way to capture users drive mappings including the drive letter and send the output to a .txt or .ini file?

Thanks

Top
#141863 - 2005-06-16 09:38 PM Re: Drive Mapping Capture
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
you could do this...

net use > output.txt

Top
#141864 - 2005-06-16 09:46 PM Re: Drive Mapping Capture
jhdvy Offline
Fresh Scripter

Registered: 2002-03-22
Posts: 44
Loc: New Jersey
Would rather not do it that way. I thought it could be done through kixtart.
Top
#141865 - 2005-06-16 09:51 PM Re: Drive Mapping Capture
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1341
Loc: NL
What is wrong about it???

This one better???
Code:
shell "cmd /c net use > c:\temp\output.txt"

_________________________
Co


Top
#141866 - 2005-06-16 09:53 PM Re: Drive Mapping Capture
jhdvy Offline
Fresh Scripter

Registered: 2002-03-22
Posts: 44
Loc: New Jersey
I thought that kixtart might have build in commands to accomplish this. The output doesn't really work for me.
Top
#141867 - 2005-06-16 09:54 PM Re: Drive Mapping Capture
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You can do it all in KiX. Just use RedirectOutput().
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#141868 - 2005-06-16 09:57 PM Re: Drive Mapping Capture
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
How about kix and WMI?

Win32_NetworkConnection

Top
#141869 - 2005-06-16 09:59 PM Re: Drive Mapping Capture
jhdvy Offline
Fresh Scripter

Registered: 2002-03-22
Posts: 44
Loc: New Jersey
Ok, How would I use Win32_NetworkConnection?
Top
#141870 - 2005-06-16 10:04 PM Re: Drive Mapping Capture
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1341
Loc: NL
Sorry, It isn't Kix and I'm to lazy to translate it for you but it does what you want:

Code:

On Error Resume Next

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

Set colItems = objWMIService.ExecQuery("Select * from Win32_MappedLogicalDisk")

For Each objItem in colItems
Wscript.Echo "Compressed: " & objItem.Compressed
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Device ID: " & objItem.DeviceID
Wscript.Echo "File System: " & objItem.FileSystem
Wscript.Echo "Free Space: " & objItem.FreeSpace
Wscript.Echo "Maximum Component Length: " & objItem.MaximumComponentLength
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "Provider Name: " & objItem.ProviderName
Wscript.Echo "Session ID: " & objItem.SessionID
Wscript.Echo "Size: " & objItem.Size
Wscript.Echo "Supports Disk Quotas: " & objItem.SupportsDiskQuotas
Wscript.Echo "Supports File-Based Compression: " & _
objItem.SupportsFileBasedCompression
Wscript.Echo "Volume Name: " & objItem.VolumeName
Wscript.Echo "Volume Serial Number: " & objItem.VolumeSerialNumber
Wscript.Echo
Next

_________________________
Co


Top
#141871 - 2005-06-16 10:06 PM Re: Drive Mapping Capture
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1341
Loc: NL
Ooh one thing:


Quote:


List Mapped Network Drives



Description
Retrieves information about mapped network drives. The information returned is similar to that available through the Win32_LogicalDisk class, which retrieves information about the logical disks found on a computer.



Supported Platforms

Windows Server 2003
Yes

Windows XP
Yes

Windows 2000
No

Windows NT 4.0
No

Windows 98
No


_________________________
Co


Top
#141872 - 2005-06-16 10:11 PM Re: Drive Mapping Capture
jhdvy Offline
Fresh Scripter

Registered: 2002-03-22
Posts: 44
Loc: New Jersey
Thanks for the script. What do I need to change in this to run it on my local workstation?
Top
#141873 - 2005-06-16 10:14 PM Re: Drive Mapping Capture
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Here you go..
Code:

CLS
BREAK ON
$strComputer = "."
$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + $strComputer + "\root\cimv2")

$colItems = $objWMIService.ExecQuery("Select * from Win32_MappedLogicalDisk")

For Each $objItem in $colItems
? "Compressed: " + $objItem.Compressed
? "Description: " + $objItem.Description
? "Device ID: " + $objItem.DeviceID
? "File System: " + $objItem.FileSystem
? "Free Space: " + $objItem.FreeSpace
? "Maximum Component Length: " + $objItem.MaximumComponentLength
? "Name: " + $objItem.Name
? "Provider Name: " + $objItem.ProviderName
? "Session ID: " + $objItem.SessionID
? "Size: " + $objItem.Size
? "Supports Disk Quotas: " + $objItem.SupportsDiskQuotas
? "Supports File-Based Compression: " + $objItem.SupportsFileBasedCompression
? "Volume Name: " + $objItem.VolumeName
? "Volume Serial Number: " + $objItem.VolumeSerialNumber
?
Next
get $



Also, you may want to check out WMIQUERY() too.

HTH,

Kent


Edited by kdyer (2005-06-16 10:15 PM)
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#141874 - 2005-06-16 10:24 PM Re: Drive Mapping Capture
jhdvy Offline
Fresh Scripter

Registered: 2002-03-22
Posts: 44
Loc: New Jersey
Looks like this is just what I need. One question though. Why would the Provide Name be blank on most of the drives?
Top
#141875 - 2005-06-16 10:30 PM Re: Drive Mapping Capture
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Before you go much further, you realize that WIN32_MappedLogicalDisk class is only present on Windows XP or above. This will not work on Windows 2000 or less.
Top
#141876 - 2005-06-16 10:32 PM Re: Drive Mapping Capture
jhdvy Offline
Fresh Scripter

Registered: 2002-03-22
Posts: 44
Loc: New Jersey
Is there anything that I can use on 2000 devices. Most of our servers are 2000.
Top
#141877 - 2005-06-16 10:44 PM Re: Drive Mapping Capture
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
FSO to the rescue again...

Code:

Dim $fso, $d, $dc
$fso = CreateObject("Scripting.FileSystemObject")
$dc = $fso.Drives
For Each $d in $dc
If $d.DriveType = 3
"Drive Letter: " + $d.DriveLetter ?
" Share Name: " + $d.ShareName ??
EndIf
Next


Top
#141878 - 2005-06-16 10:48 PM Re: Drive Mapping Capture
jhdvy Offline
Fresh Scripter

Registered: 2002-03-22
Posts: 44
Loc: New Jersey
Thanks you so much. What if I want to store it in an .ini file?
Top
#141879 - 2005-06-16 10:50 PM Re: Drive Mapping Capture
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Sure, you can use WriteProfileString() to write it to an .ini file.
Top
#141880 - 2005-06-16 10:54 PM Re: Drive Mapping Capture
jhdvy Offline
Fresh Scripter

Registered: 2002-03-22
Posts: 44
Loc: New Jersey
I know I'm pushing it but would you have an example on how to do that?
Top
#141881 - 2005-06-16 10:55 PM Re: Drive Mapping Capture
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
There is an example in the manual.

Sorry, but I have to go coach my daughter's softball team.

Top
Page 1 of 3 123>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 382 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.172 seconds in which 0.099 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org