Jump to content

Single State Disk how to findout?


lgvlgv
 Share

Recommended Posts

I wrote a simple program that runs locally and checks some settings/hardware on local machines and then report the information back to a webserver.

now i wantet to add some functionality ex: add a defrag and cleanup tasks to the computer to run every night, but if the local machine has SSD disks i dont want to scheadule a defrag sence that hurts the SSD disks beeing only a "memory" and not a real old fashion disk....

Any one have any idea how to find out if any of the local disk are SSD?

I dont think the OS is aware of the SSD disk at all..

PS.

found this on the web but havent tryed it yet...

-------------

I dunno if SSD's all show up as RAM drives, but here's a rework of some code I use to get drive information.

Function SSD

Set FSO = Server.CreateObject("Scripting.FileSystemObject")

Set Drives = FSO.Drives

For Each Disk in Drives

If Disk.DriveType = 5 Then

'This disk is a RAM drive

'Do something

End if

Next

End Function

-------------

//Regards Lasse

Edited by lgvlgv
Link to comment
Share on other sites

The DriveGetType function returns "Unknown", "Removable", "Fixed", "Network", "CDROM", "RAMDisk". Not sure if one of these is any use to you. You might be able to edit the underlying library to get what you need.

Thx.

i will play with it and see how it works, i guess playing with underlying librarys is to advanced for my knowlige but i will give it a try :mellow:

Link to comment
Share on other sites

Have you thought about WMI, perhaps Win32_DiskDrive or Win32_LogicalDisk. Search Scriptomatic to easily create WMI code.

I would think .InterfaceType would provide the correct information, though I don't have a SSD to test with.

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Have you thought about WMI, perhaps Win32_DiskDrive or Win32_LogicalDisk. Search Scriptomatic to easily create WMI code.

I would think .InterfaceType would provide the correct information, though I don't have a SSD to test with.

Thx i will try this :mellow:
Link to comment
Share on other sites

This is the result i get from: Win32_DiskDrive, Win32_LogicalDisk dident show anything good in this case,,,,

There are some names/Caption i could use but then again i need to know all SSD disks in the world :/

***************

Computer: localhost

Availability:

BytesPerSector: 512

Capabilities: 3

CapabilityDescriptions:

Caption: OCZ CORE_SSD

CompressionMethod:

ConfigManagerErrorCode: 0

ConfigManagerUserConfig: False

CreationClassName: Win32_DiskDrive

DefaultBlockSize:

Description: Diskenhet

DeviceID: \\.\PHYSICALDRIVE0

ErrorCleared:

ErrorDescription:

ErrorMethodology:

Index: 0

InstallDate: // ::

InterfaceType: IDE

LastErrorCode:

Manufacturer: (Standarddiskenheter)

MaxBlockSize:

MaxMediaSize:

MediaLoaded: True

MediaType: Fixed hard disk media

MinBlockSize:

Model: OCZ CORE_SSD

Name: \\.\PHYSICALDRIVE0

NeedsCleaning:

NumberOfMediaSupported:

Partitions: 1

PNPDeviceID: IDE\DISKOCZ_CORE_SSD____________________________02.10104\4B4D313038303034333134413042373020302020

PowerManagementCapabilities:

PowerManagementSupported:

SCSIBus: 0

SCSILogicalUnit: 0

SCSIPort: 0

SCSITargetId: 0

SectorsPerTrack: 63

Signature: 1265149345

Size: 64099607040

Status: OK

StatusInfo:

SystemCreationClassName: Win32_ComputerSystem

SystemName: SPEL

TotalCylinders: 7793

TotalHeads: 255

TotalSectors: 125194545

TotalTracks: 1987215

TracksPerCylinder: 255

Availability:

BytesPerSector: 512

Capabilities: 3

CapabilityDescriptions:

Caption: WDC WD1600JS-60MHB5

CompressionMethod:

ConfigManagerErrorCode: 0

ConfigManagerUserConfig: False

CreationClassName: Win32_DiskDrive

DefaultBlockSize:

Description: Diskenhet

DeviceID: \\.\PHYSICALDRIVE1

ErrorCleared:

ErrorDescription:

ErrorMethodology:

Index: 1

InstallDate: // ::

InterfaceType: IDE

LastErrorCode:

Manufacturer: (Standarddiskenheter)

MaxBlockSize:

MaxMediaSize:

MediaLoaded: True

MediaType: Fixed hard disk media

MinBlockSize:

Model: WDC WD1600JS-60MHB5

Name: \\.\PHYSICALDRIVE1

NeedsCleaning:

NumberOfMediaSupported:

Partitions: 1

PNPDeviceID: IDE\DISKWDC_WD1600JS-60MHB5_____________________10.02E04\5&5C6CFD6&0&0.0.0

PowerManagementCapabilities:

PowerManagementSupported:

SCSIBus: 0

SCSILogicalUnit: 0

SCSIPort: 1

SCSITargetId: 0

SectorsPerTrack: 63

Signature: -735390678

Size: 160039272960

Status: OK

StatusInfo:

SystemCreationClassName: Win32_ComputerSystem

SystemName: SPEL

TotalCylinders: 19457

TotalHeads: 255

TotalSectors: 312576705

TotalTracks: 4961535

TracksPerCylinder: 255

Link to comment
Share on other sites

The compiled Scriptomatic is in my signature and you will (as guinness pointed out) be looking for Win32_DiskDrive and MediaType in particular. You may also be able to get the info by checking the TotalCylinders, TotalHeads, TotalSectors, and TracksPerCylinder. I can't test it but I think they will all be 0 or blank for an SSD.

EDIT:

Our posts crossed so it looks as though the answer doesn't lie in Win_32DiskDrive.

EDIT 2:

You might still be able to use it. looking at either Model or Caption. Check several drives and see it they all return a string with CORE_ or _SSD in one of those fields.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

There is one way >> use the second example & then use StringInStr() to search for SSD on the information contained within PNPDeviceID. It's a quick & dirty example as KaFu put it, but it's the closest thing I can think of.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

There is one way >> use the second example & then use StringInStr() to search for SSD on the information contained within PNPDeviceID. It's a quick & dirty example as KaFu put it, but it's the closest thing I can think of.

Here is the link to download the compile scriptomatic tool. i got it from from GeoSoft's signature http://dundats.mvps.org/AutoIt/files/AI_Scriptomatic.zip

i will go for the quick and dirty now becose i can/have control over my enviroment. just scared if any of my customer comes with a new laptop(with SSD disk that dosent have SSD in the name) and my scripts scheadual a derfrag on hes computer..

Thx anyway for the quick respnse on these forums. :mellow:

Link to comment
Share on other sites

Here are a couple of things I found on line

A quote only valid for win7

"If solid-state media is detected, Windows disables defragmentation on that disk. The physical nature of solid-state media is such that defragmentation is not needed and in fact, could decrease overall media lifetime in certain cases."

And from Intel we have this. It may well apply to all SSDs or they may also be refering only to Windows 7

The setup for using Intel SSD as cache is to use 311 series SSD as the cache disk, installed OS on the RAID HDD (traditional hard disk). Since the SSD will work as a cache, OS will not defrag a cache.

I'm also thinking that using USB sticks should enable you to test code for various drives.

I also found out that another way is to check the rotational speed of the drive which should return 0x001 but I don't know where to get that info from.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Perhaps _WinAPI_GetDriveBusType() in WinAPIEx.au3 by Yashied will help?!

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Try this function. Main idea was from Yashied but I took a different approach.

Func _GetDriveBusType($sDrive)
Local $aArray[14][2] = [[$DRIVE_BUS_TYPE_UNKNOWN, 'UNKNOWN'], _
[$DRIVE_BUS_TYPE_SCSI, 'SCSI'], _
[$DRIVE_BUS_TYPE_ATAPI, 'ATAPI'], _
[$DRIVE_BUS_TYPE_ATA, 'ATA'], _
[$DRIVE_BUS_TYPE_1394, '1394'], _
[$DRIVE_BUS_TYPE_SSA, 'SSA'], _
[$DRIVE_BUS_TYPE_FIBRE, 'FIBRE'], _
[$DRIVE_BUS_TYPE_USB, 'USB'], _
[$DRIVE_BUS_TYPE_RAID, 'RAID'], _
[$DRIVE_BUS_TYPE_ISCSI, 'ISCSI'], _
[$DRIVE_BUS_TYPE_SAS, 'SAS'], _
[$DRIVE_BUS_TYPE_SATA, 'SATA'], _
[$DRIVE_BUS_TYPE_SD, 'SD'], _
[$DRIVE_BUS_TYPE_MMC, 'MMC']]
Return $aArray[_WinAPI_GetDriveBusType($sDrive & ":")][1]
EndFunc ;==>_GetDriveBusType
Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

SSD - Solid-State Drive rather than Single State Disk.

Not exactly a reliable way, but still...

Func _DriveIsSSD($sDrive)

    Local $oService, $oItems, $Disk = '', $Part = '', $Text = ''

    $oService = ObjGet('winmgmts:\\.\root\cimv2')
    If Not IsObj($oService) Then
        Return SetError(1, 0, 0)
    EndIf
    $oItems = $oService.ExecQuery('SELECT * FROM Win32_LogicalDiskToPartition')
    If Not IsObj($oItems) Then
        Return SetError(2, 0, 0)
    EndIf
    For $Property In $oItems
        If StringInStr($Property.Dependent, '"' & $sDrive & '"') Then
            $Part = StringTrimLeft($Property.Antecedent, StringInStr($Property.Antecedent, '='))
            ExitLoop
        EndIf
    Next
    If Not $Part Then
        Return SetError(3, 0, 0)
    EndIf
    $oItems = $oService.ExecQuery('SELECT * FROM Win32_DiskDriveToDiskPartition')
    If Not IsObj($oItems) Then
        Return SetError(2, 0, 0)
    EndIf
    For $Property In $oItems
        If StringInStr($Property.Dependent, $Part) Then
            $Disk = StringTrimLeft($Property.Antecedent, StringInStr($Property.Antecedent, '='))
            ExitLoop
        EndIf
    Next
    If Not $Disk Then
        Return SetError(3, 0, 0)
    EndIf
    $oItems = $oService.ExecQuery('SELECT * FROM Win32_DiskDrive WHERE DeviceID = ' & $Disk)
    If Not IsObj($oItems) Then
        Return SetError(2, 0, 0)
    EndIf
    For $Property In $oItems
        $Text = $Property.PnPDeviceID
        ExitLoop
    Next
    If Not $Text Then
        Return SetError(3, 0, 0)
    EndIf
    If StringInStr($Text, 'SSD') Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc   ;==>_DriveIsSSD

I'm just looking for the "SSD" keyword in device ID.

IDEDISKINTEL_SSDSA2CW120G3_____________________4PC103025&54771BF&0&0.0.0

Edited by Yashied
Link to comment
Share on other sites

Thats how I would've done it, also looking at my last post SD is for a SD card not a solid state drive. Whoops! Yashied created the function i was suggesting to do in my previous post :graduated:

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Yashied!

First query just returned local host?

i modifyed little but dont know if i missed something??, it dosent work with the WHERE statement but works without??

Help anyone :graduated:

-----

MsgBox(64,"test",_DriveIsSSD("\\.\PHYSICALDRIVE0"))
 
Func _DriveIsSSD($isDrive)
    Local $oService, $objItem, $Text = '',$Text1='',$Text2="",$i=0,$y=0
$strComputer = "localhost"
$oService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $oService.ExecQuery('SELECT * FROM Win32_DiskDrive WHERE DeviceID = "' & $isDrive & '"')
    For $objItem In $colItems
$Text = $objItem.PNPDeviceID & @LF
$Text1 = $objItem.Model & @LF
$text2 = $objItem.DeviceID & @LF
If StringInStr($Text, 'SSD') or StringInStr($Text1, 'SSD') Then
Return 1
Else
Return 0
EndIf
   Next
EndFunc   ;==>_DriveIsSSD
Edited by lgvlgv
Link to comment
Share on other sites

Try this function. Main idea was from Yashied but I took a different approach.

Func _GetDriveBusType($sDrive)
Local $aArray[14][2] = [[$DRIVE_BUS_TYPE_UNKNOWN, 'UNKNOWN'], _
[$DRIVE_BUS_TYPE_SCSI, 'SCSI'], _
[$DRIVE_BUS_TYPE_ATAPI, 'ATAPI'], _
[$DRIVE_BUS_TYPE_ATA, 'ATA'], _
[$DRIVE_BUS_TYPE_1394, '1394'], _
[$DRIVE_BUS_TYPE_SSA, 'SSA'], _
[$DRIVE_BUS_TYPE_FIBRE, 'FIBRE'], _
[$DRIVE_BUS_TYPE_USB, 'USB'], _
[$DRIVE_BUS_TYPE_RAID, 'RAID'], _
[$DRIVE_BUS_TYPE_ISCSI, 'ISCSI'], _
[$DRIVE_BUS_TYPE_SAS, 'SAS'], _
[$DRIVE_BUS_TYPE_SATA, 'SATA'], _
[$DRIVE_BUS_TYPE_SD, 'SD'], _
[$DRIVE_BUS_TYPE_MMC, 'MMC']]
Return $aArray[_WinAPI_GetDriveBusType($sDrive & ":")][1]
EndFunc ;==>_GetDriveBusType

Only returns ATA :graduated:

Edited by lgvlgv
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...