Jump to content
Sign in to follow this  
AdamGJohnson

DriveGetDrive on remote computer

Recommended Posts

AdamGJohnson

Hi guys,

Its been a while since I've used Autoit and was hoping that you all might be able to help me. Basically I need to check drive letters assigned to a remote computer. Its only the local drives so C: D: E: etc, doesn't need to be mapped drives. I've tried using DriveGetDrive but I can't work out how to search remote computers. Any help is appreciated!

Thanks for your time

Share this post


Link to post
Share on other sites
JLogan3o13

@AdamGJohnson you can do it with WMI, as long as you can connect to the machine:

Local $sPC = "RFHIS71"
Local $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sPC & "\root\cimv2")
    If IsObj($oWMI) Then
        $oDisks = $oWMI.ExecQuery("Select * from Win32_LogicalDisk Where DriveType='3'") ;3 - Local Disk
            If IsObj($oDisks) Then
                For $sDisk in $oDisks
                    ConsoleWrite($sDisk.FreeSpace & @CRLF)
                Next
            Else
                ConsoleWrite("Unable to collect LogicalDisk class info from " & $sPC & @CRLF)
            EndIf
    Else
        ConsoleWrite("Unable to connect to WMI on " & $sPC & @CRLF)
    EndIf

 


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
AdamGJohnson

Thanks for that! Its telling me the free space on the disk. How do I get it to tell me which drive letters are being used? I'm assuming the 'FreeSpace' needs to be changed, but I am uncertain to what. I really appreciate it.

Share this post


Link to post
Share on other sites
JLogan3o13

IIRC it would be Caption. I suggest doing a search on the forum for ScriptoMatic (downloads section). That will allow you to see all of the classes and their objects. If you look under win32_logicaldisk it will show you everything you can report on. 


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×