{"id":1952,"date":"2023-03-20T11:00:00","date_gmt":"2023-03-20T02:00:00","guid":{"rendered":"https:\/\/testhagisolcojp.gptw.net\/techblog\/?p=1952"},"modified":"2024-07-17T07:44:51","modified_gmt":"2024-07-16T22:44:51","slug":"post-1952","status":"publish","type":"post","link":"https:\/\/testhagisolcojp.gptw.net\/techblog\/?p=1952","title":{"rendered":"PowerShell\u30b9\u30af\u30ea\u30d7\u30c8\u3060\u3051\u3067NVMe SSD\u306eS.M.A.R.T.\u30ed\u30b0\u3092\u53d6\u5f97\u3059\u308b"},"content":{"rendered":"\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-50\"><a class=\"wp-block-button__link has-white-color has-vivid-cyan-blue-background-color has-text-color has-background wp-element-button\" href=\"https:\/\/testhagisolcojp.gptw.net\/form\/contact.php\"><strong>\u304a\u554f\u3044\u5408\u308f\u305b\u306f\u3053\u3061\u3089<\/strong><\/a><\/div>\n<\/div>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img decoding=\"async\" src=\"https:\/\/testhagisolcojp.gptw.net\/techblog\/wp-content\/uploads\/2023\/01\/AdobeStock_561451467-1024x683.jpeg\" alt=\"\" class=\"wp-image-1973\"\/><\/figure>\n\n\n\n<h2 id=\"outline__1\" class=\"wp-block-heading\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u3053\u306e\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u3066\u3044\u308b\u88fd\u54c1<\/mark><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a rel=\"noreferrer noopener\" href=\"https:\/\/testhagisolcojp.gptw.net\/products\/storage\" target=\"_blank\">\u7523\u696d\u7528\u30b9\u30c8\u30ec\u30fc\u30b8\u88fd\u54c1(NVMe SSD)<\/a><\/li>\n<\/ul>\n\n\n\n<h2 id=\"outline__2\" class=\"wp-block-heading\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u304a\u3053\u3068\u308f\u308a<\/mark><\/h2>\n\n\n\n<p>\u3000\u3053\u306e\u8a18\u4e8b\u306f\u3001<a rel=\"noreferrer noopener\" href=\"https:\/\/qiita.com\/ken-yossy\/items\/d87642c143c64ef82626\" target=\"_blank\">2021\u5e745\u6708\u306bQiita\u306b\u6295\u7a3f\u3057\u305f\u8a18\u4e8b<\/a>\u3092\u52a0\u7b46\u4fee\u6b63\u3057\u305f\u3082\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u307e\u305f\u3001\u3053\u306e\u8a18\u4e8b\u306e\u30aa\u30ea\u30b8\u30ca\u30eb\u306f\u65e5\u672c\u8a9e\u3067\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002\u8a18\u4e8b\u304c\u65e5\u672c\u8a9e\u4ee5\u5916\u306e\u8a00\u8a9e\u3067\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u3001\u305d\u308c\u306f\u6a5f\u68b0\u7ffb\u8a33\u306e\u7d50\u679c\u3067\u3059\u3002\u5f53\u793e\u306f\u6a5f\u68b0\u7ffb\u8a33\u306e\u7cbe\u5ea6\u306b\u8cac\u4efb\u3092\u8ca0\u3044\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<h2 id=\"outline__3\" class=\"wp-block-heading\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u306f\u3058\u3081\u306b<\/mark><\/h2>\n\n\n\n<p>\u3000Windows\u4e0a\u3067NVMe SSD\u306eS.M.A.R.T.\u30ed\u30b0\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3068\u3057\u3066\u306f\u3001<a rel=\"noreferrer noopener\" href=\"https:\/\/crystalmark.info\/ja\/software\/crystaldiskinfo\/\" target=\"_blank\">CrystalDiskInfo<\/a>\u3084\u5f53\u793e\u306e<a rel=\"noreferrer noopener\" href=\"https:\/\/testhagisolcojp.gptw.net\/technology\/livemonitor.php\" target=\"_blank\">LiveMonitorPlus<\/a>\u306e\u3088\u3046\u306b\u3001\u72ec\u7acb\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u304c\u4e00\u822c\u7684\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u3053\u308c\u3089\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u5229\u70b9\u306f\u3001\u30c7\u30fc\u30bf\u3092GUI\u4ed8\u304d\u306e\u308f\u304b\u308a\u3084\u3059\u3044\u753b\u9762\u3067\u78ba\u8a8d\u3067\u304d\u308b\u70b9\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u4e00\u65b9\u3067\u3053\u306e\u65b9\u6cd5\u306f\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5e38\u99d0\u3055\u305b\u305f\u308a\u305b\u305a\u306b\u3001\u304b\u3064\u4eba\u306e\u64cd\u4f5c\u306a\u3057\u306b1\u6642\u9593\u306b1\u56de\u306a\u3069\u306e\u9593\u9694\u3067\u5b9a\u671f\u7684\u306b\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3066\u7570\u5e38\u5024\u304c\u3042\u308c\u3070\u901a\u77e5\u3059\u308b\u3001\u306a\u3069\u306e\u7528\u9014\u306b\u306f\u5411\u304d\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p>\u3000\u307e\u305f\u3001\u30b5\u30fc\u30d0\u7ba1\u7406\u306a\u3069\u3067\u306f\u300c\u5358\u6a5f\u80fd\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u6240\u671b\u306e\u51e6\u7406\u3092\u5b9f\u73fe\u3059\u308b\u300d\u3068\u3044\u3046\u65b9\u6cd5\u304c\u7528\u3044\u3089\u308c\u308b\u3053\u3068\u3082\u591a\u304f\u3001\u3088\u308a\u7c21\u4fbf\u306a\u65b9\u6cd5\u3067NVMe SSD\u306eS.M.A.R.T.\u30ed\u30b0\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u304c\u3042\u308b\u3068\u4fbf\u5229\u3067\u3059\u3002Unix\u7cfbOS\u3067\u306f<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/linux-nvme\/nvme-cli\" target=\"_blank\">nvme-cli\u30d1\u30c3\u30b1\u30fc\u30b8<\/a>\u3084<a rel=\"noreferrer noopener\" href=\"https:\/\/www.smartmontools.org\/\" target=\"_blank\">smartmontools\u30d1\u30c3\u30b1\u30fc\u30b8<\/a>\uff08smartctl\u30b3\u30de\u30f3\u30c9\uff09\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u305d\u3053\u3067\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Windows\u3067\u3042\u308c\u3070\u6a19\u6e96\u3067\u5229\u7528\u53ef\u80fd\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u74b0\u5883PowerShell\u3068Windows\u306eMicrosoft\u6a19\u6e96NVMe\u30c7\u30d0\u30a4\u30b9\u30c9\u30e9\u30a4\u30d0\u3092\u7528\u3044\u3066NVMe SSD\u306eS.M.A.R.T.\u30ed\u30b0\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\u3053\u306e\u65b9\u6cd5\u3067\u306f\u5c02\u7528\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3084\u5e38\u99d0\u304c\u4e0d\u8981\u3067\u3001\u304b\u3064\u5fc5\u8981\u306a\u6642\u306b\u5fc5\u8981\u306a\u60c5\u5831\u306e\u307f\u52a0\u5de5\u304c\u5bb9\u6613\u306a\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u53d6\u5f97\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u306a\u304a\u3001\u8a18\u4e8b\u5185\u3067\u306f\u30b9\u30af\u30ea\u30d7\u30c8\u305d\u306e\u3082\u306e\u306b\u3064\u304d\u307e\u3057\u3066\u306f\u30dd\u30a4\u30f3\u30c8\u306e\u307f\u8a18\u8f09\u3057\u307e\u3059\u3002\u30b9\u30af\u30ea\u30d7\u30c8\u5168\u4f53\u306f<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/ken-yossy\/nvmetool-win-powershell\" target=\"_blank\">GitHub\u306e\u30ea\u30dd\u30b8\u30c8\u30ea<\/a>\u3067\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h2 id=\"outline__4\" class=\"wp-block-heading\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u307e\u3068\u3081<\/mark><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PowerShell\u30b9\u30af\u30ea\u30d7\u30c8\u3060\u3051\u3067\u3001Windows\u306e\u6a19\u6e96NVMe\u30c7\u30d0\u30a4\u30b9\u30c9\u30e9\u30a4\u30d0\u3092\u4f7f\u3044NVMe\u30c9\u30e9\u30a4\u30d6\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066S.M.A.R.T.\u30ed\u30b0\u3092\u53d6\u5f97\u3067\u304d\u308b<\/li>\n\n\n\n<li><span style=\"color: initial;\">\u3053\u306e\u65b9\u6cd5\u306fS.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u4ee5\u5916\u306e\u53d6\u5f97\u306b\u3082\u5fdc\u7528\uff08\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\uff09\u53ef\u80fd<\/span><\/li>\n\n\n\n<li>\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u6642\u306f\u3001<code>DeviceIoControl()<\/code>\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u8a2d\u5b9a\u3068\u53d6\u5f97\u3057\u305f\u30c7\u30fc\u30bf\u306e\u53d6\u6271\u3044\u306b\u6ce8\u610f<\/li>\n<\/ul>\n\n\n\n<h2 id=\"outline__5\" class=\"wp-block-heading\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u4f7f\u3044\u304b\u305f<\/mark><\/h2>\n\n\n\n<p>\u3000\u65e9\u901f\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u4f7f\u7528\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\u30b9\u30af\u30ea\u30d7\u30c8\u540d\u306f<code>get-smart-log.ps1<\/code>\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u969b\u306bS.M.A.R.T.\u30ed\u30b0\u3092\u53d6\u5f97\u3059\u308b\u5bfe\u8c61NVMe\u30c9\u30e9\u30a4\u30d6\u306e\u30c9\u30e9\u30a4\u30d6\u756a\u53f7\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u300c\u30c9\u30e9\u30a4\u30d6\u756a\u53f7\u300d\u306f\u300c\u30c7\u30a3\u30b9\u30af\u306e\u7ba1\u7406\u300d\u30c0\u30a4\u30a2\u30ed\u30b0\u3067\u78ba\u8a8d\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img decoding=\"async\" src=\"https:\/\/testhagisolcojp.gptw.net\/techblog\/wp-content\/uploads\/2023\/02\/disk-management-dialog.png\" alt=\"\" class=\"wp-image-2018\"\/><figcaption class=\"wp-element-caption\"><em>\u56f31\uff1a\u300c\u30c7\u30a3\u30b9\u30af\u306e\u7ba1\u7406\u300d\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u4f7f\u7528\u3057\u305f\u300c\u30c9\u30e9\u30a4\u30d6\u756a\u53f7\u300d\u306e\u78ba\u8a8d\u65b9\u6cd5<\/em><\/figcaption><\/figure>\n\n\n\n<p>\u3000\u4eca\u56de\u306f\u3053\u306e\u300c\u30c7\u30a3\u30b9\u30af0\u300d\u306eS.M.A.R.T.\u30ed\u30b0\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002\u3053\u306e\u5834\u5408\u300c\u30c9\u30e9\u30a4\u30d6\u756a\u53f7\u300d\u306f0\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u6b21\u306b<strong>\u7ba1\u7406\u8005\u6a29\u9650\u4ed8\u304d<\/strong>\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\uff08\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u3084PowerShell\u30b3\u30f3\u30bd\u30fc\u30eb\uff09\u3092\u8d77\u52d5\u3057\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u7f6e\u304b\u308c\u3066\u3044\u308b\u30d5\u30a9\u30eb\u30c0\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5165\u529b\u3057\u307e\u3059\u3002\u30d5\u30a9\u30eb\u30c0\u540d\u306f\u3054\u4f7f\u7528\u306e\u74b0\u5883\u306b\u5408\u308f\u305b\u3066\u8aad\u307f\u66ff\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PowerShell\u306e\u5834\u5408\uff1a\nPS C:\\Users\\hagisol\\Downloads&gt; .\\get-smart-log.ps1 0\n\n\u901a\u5e38\u306e\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u306e\u5834\u5408\uff1a\nC:\\Users\\hagisol\\Downloads&gt; powershell .\\get-smart-log.ps1 0<\/code><\/pre>\n\n\n\n<p>\u3000\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u51fa\u529b\u3055\u308c\u307e\u3059\uff08PowerShell\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\uff09\u3002\u3053\u308c\u304cNVMe\u30c9\u30e9\u30a4\u30d6\u304b\u3089\u53d6\u5f97\u3057\u305fS.M.A.R.T.\u30ed\u30b0\u3067\u3059\u3002\u3053\u308c\u306f\u5f53\u793e\u88fdH\u30b7\u30ea\u30fc\u30baNVMe SSD\u3067\u8a66\u3057\u305f\u7d50\u679c\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>PS C:\\Users\\hagisol\\downloads&gt; .\\get-smart-log.ps1 0\nCritical Warning: 0x00\nComposite Temperature: 311 (K)\nAvailable Spare: 100 (%)\nAvailable Spare Threshold: 10 (%)\nPercentage Used: 0 (%)\nEndurance Group Summary: 0x00\nData Unit Read: 0x000000000028F6A7\nData Unit Written: 0x000000000040665F\nHost Read Commands: 0x0000000002EE9E5E\nHost Write Commands: 0x00000000047DDD20\nController Busy Time: 0x0000000000002946 (minutes)\nPower Cycles: 0x0000000000000053\nPower On Hours: 0x000000000000014F (hours)\nUnsafe Shutdowns: 0x0000000000000011\nMedia and Data Integrity Errors: 0x0000000000000000\nNumber of Error Information Entries: 0x0000000000000000\nWarning Composite Temperature Time: 0 (minutes)\nCritical Composite Temperature Time: 0 (minutes)\nTemperature Sensor 1: 331 (K)\nTemperature Sensor 2: 328 (K)\nTemperature Sensor 3: 311 (K)\nTemperature Sensor 4: 0 (K)\nTemperature Sensor 5: 0 (K)\nTemperature Sensor 6: 0 (K)\nTemperature Sensor 7: 0 (K)\nTemperature Sensor 8: 0 (K)\nThermal Management Temperature 1 Transition Count: 0 (times)\nThermal Management Temperature 2 Transition Count: 0 (times)\nTotal Time For Thermal Management Temperature 1: 0 (seconds)\nTotal Time For Thermal Management Temperature 2: 0 (seconds)<\/code><\/code><\/pre>\n\n\n\n<p>\u3000\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff08Windows 11\u3067\u306e\u5b9f\u884c\u7d50\u679c\uff09\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img decoding=\"async\" src=\"https:\/\/testhagisolcojp.gptw.net\/techblog\/wp-content\/uploads\/2023\/02\/result-of-getting-smart-log.png\" alt=\"\" class=\"wp-image-2015\"\/><figcaption class=\"wp-element-caption\"><em>\u56f32\uff1aS.M.A.R.T.\u30ed\u30b0\u53d6\u5f97PowerShell\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u51fa\u529b\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8<\/em><\/figcaption><\/figure>\n\n\n\n<p>\u3000\u56f32\u306e\u3088\u3046\u306b\u53d6\u5f97\u7d50\u679c\u306f\u30d7\u30ec\u30fc\u30f3\u30c6\u30ad\u30b9\u30c8\u3067\u51fa\u529b\u3055\u308c\u307e\u3059\u306e\u3067\u3001\u30d5\u30a1\u30a4\u30eb\u3078\u306e\u8a18\u9332\uff08\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\uff09\u3084\u6587\u5b57\u5217\u691c\u7d22\u306b\u3088\u308b\u7279\u5b9a\u9805\u76ee\u306e\u629c\u304d\u51fa\u3057\u306a\u3069\u304c\u5bb9\u6613\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u3055\u3089\u306b\u8a00\u3048\u3070\u3001\u51fa\u529b\u5f62\u5f0f\uff08\u6587\u5b57\u5217\uff09\u5909\u66f4\u306a\u3069\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3082\u5bb9\u6613\u3067\u3059\u3002<\/p>\n\n\n\n<h2 id=\"outline__6\" class=\"wp-block-heading\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u8aac\u660e<\/mark><\/h2>\n\n\n\n<p>\u3000\u3053\u3053\u304b\u3089\u306f\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30dd\u30a4\u30f3\u30c8\u3092\u3054\u8aac\u660e\u3057\u307e\u3059\u3002\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3055\u308c\u308b\u969b\u3084\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u571f\u53f0\u306b\u3054\u6240\u671b\u306e\u51e6\u7406\u3092\u884c\u3046\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3055\u308c\u308b\u969b\u306e\u3054\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<h3 id=\"outline__6_1\" class=\"wp-block-heading\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u30dd\u30a4\u30f3\u30c8<\/mark><\/h3>\n\n\n\n<p>\u3000\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u6b21\u306e3\u70b9\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>CreateFile()<\/code>\u3068<code>DeviceIoControl()<\/code>\u3092PowerShell\u304b\u3089\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u306b\u3059\u308b<\/li>\n\n\n\n<li>\u4e21API\u306b\u9069\u5207\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6e21\u3059<\/li>\n\n\n\n<li>API\u304b\u3089\u8fd4\u3055\u308c\u305f\u30c7\u30fc\u30bf\u304b\u3089S.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u3092\u5f15\u304d\u51fa\u3059<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u4ee5\u4e0b\u3053\u308c\u30893\u3064\u306e\u30dd\u30a4\u30f3\u30c8\u3092\u3054\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 id=\"outline__6_2\" class=\"wp-block-heading\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u5fc5\u8981\u306aAPI\u3092\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u306b\u3059\u308b<\/mark><\/h3>\n\n\n\n<p>\u3000\u3053\u308c\u306fReddit\u306e\u6295\u7a3f<sup>[1]<\/sup>\u3092\u53c2\u8003\u306b\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3067\u5b9f\u73fe\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$KernelService = Add-Type -Name 'Kernel32' -Namespace 'Win32' -PassThru -MemberDefinition @\"\n    &#91;DllImport(\"kernel32.dll\", CharSet = CharSet.Auto, SetLastError = true)]\n    public static extern IntPtr CreateFile(\n        String lpFileName,\n        UInt32 dwDesiredAccess,\n        UInt32 dwShareMode,\n        IntPtr lpSecurityAttributes,\n        UInt32 dwCreationDisposition,\n        UInt32 dwFlagsAndAttributes,\n        IntPtr hTemplateFile);\n\n    &#91;DllImport(\"Kernel32.dll\", SetLastError = true)]\n    public static extern bool DeviceIoControl(\n        IntPtr  hDevice,\n        int     oControlCode,\n        IntPtr  InBuffer,\n        int     nInBufferSize,\n        IntPtr  OutBuffer,\n        int     nOutBufferSize,\n        ref int pBytesReturned,\n        IntPtr  Overlapped);\n\"@\n\n$DeviceHandle = $KernelService::CreateFile(\"\\\\.\\PhysicalDrive$PhyDrvNo\", &#91;System.Convert]::ToUInt32($AccessMask), $AccessMode, &#91;System.IntPtr]::Zero, $AccessEx, $AccessAttr, &#91;System.IntPtr]::Zero);\n$CallResult = $KernelService::DeviceIoControl($DeviceHandle, $IoControlCode, $OutBuffer, $OutBufferSize, $OutBuffer, $OutBufferSize, &#91;ref]$ByteRet, &#91;System.IntPtr]::Zero);<\/code><\/pre>\n\n\n\n<p>\u3000\u3053\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u3067\u3001\u5225\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u306eAPI\uff08<kbd>CreateFile()<\/kbd>\u3068<kbd>DeviceIoControl()<\/kbd>\uff09\u3092\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 id=\"outline__6_3\" class=\"wp-block-heading\"><a href=\"https:\/\/qiita.com\/ken-yossy\/items\/d87642c143c64ef82626#%E4%B8%A1api%E3%81%AB%E9%81%A9%E5%88%87%E3%81%AA%E3%83%91%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF%E3%82%92%E6%B8%A1%E3%81%99\"><\/a><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u4e21API\u306b\u9069\u5207\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6e21\u3059<\/mark><\/h3>\n\n\n\n<p>\u3000<code>CreateFile()<\/code>\u3068<code>DeviceIoControl()<\/code>\u3092\u547c\u3073\u51fa\u3059\u969b\u306b\u306f\u9069\u5207\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6e21\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u3053\u3067\u306f3\u70b9\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u305d\u308c\u306f\u3001\u300c<code>CreateFile()<\/code>\u306e\u5f15\u6570\u3092\u3069\u3046\u4f5c\u308b\u304b\u300d\u3001\u300c<code>DeviceIoControl()<\/code>\u306e\u5f15\u6570\uff08\u69cb\u9020\u4f53\uff09\u3092\u3069\u3046\u4f5c\u308b\u304b\u300d\u3001\u305d\u3057\u3066\u300c\u69cb\u9020\u4f53\u3078\u306e\u30dd\u30a4\u30f3\u30bf\u3092\u3069\u3046\u53d6\u5f97\u3059\u308b\u304b\u300d\u3067\u3059\u3002<\/p>\n\n\n\n<h4 id=\"outline__6_3_1\" class=\"wp-block-heading\"><a href=\"https:\/\/qiita.com\/ken-yossy\/items\/d87642c143c64ef82626#createfile%E3%81%AE%E5%BC%95%E6%95%B0\"><\/a><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"><code>CreateFile()<\/code>\u306e\u5f15\u6570<\/mark><\/h4>\n\n\n\n<p>\u3000\u307e\u305a<code>CreateFile()<\/code>\u306b\u6e21\u3059\u5f15\u6570\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000<code>CreateFile()<\/code>\u306e2\u3064\u76ee\u306e\u5f15\u6570\u306b\u306f\u3001\u884c\u3044\u305f\u3044\u30a2\u30af\u30bb\u30b9\u306e\u5185\u5bb9\uff08Read\u3084Write\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u3053\u3053\u306b\u306f<code>GENERIC_READ (0x80000000)<\/code>\u3068<code>GENERIC_WRITE (0x40000000)<\/code>\u306e\u8ad6\u7406\u548c\u3067\u3042\u308b<code>0xC0000000<\/code>\u306e\u6307\u5b9a\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u3057\u304b\u3057\u3001\u5358\u306b<code>0xC0000000<\/code>\u3092\u6307\u5b9a\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u3066\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002\u5909\u6570\u306b\u4ee3\u5165\u3057\u3066\u305d\u306e\u5909\u6570\u3092\u5f15\u6570\u306b\u5165\u308c\u3066\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>&#8220;CreateFile&#8221; \u306e\u5f15\u6570 &#8220;dwDesiredAccess&#8221; (\u5024 &#8220;-1073741824&#8221;) \u3092\u578b &#8220;System.UInt32&#8221; \u306b\u5909\u63db\u3067\u304d\u307e\u305b\u3093: &#8220;\u5024 &#8220;-1073741824&#8221; \u3092\u578b &#8220;System.UInt32&#8221; \u306b\u5909\u63db\u3067\u304d\u307e\u305b\u3093\u3002\u30a8\u30e9\u30fc: &#8220;UInt32 \u578b\u306e\u5024\u304c\u5927\u304d\u3059\u304e\u308b\u304b\u3001\u307e\u305f\u306f\u5c0f\u3055\u3059\u304e\u307e\u3059\u3002&#8221;&#8221;<\/p>\n<\/blockquote>\n\n\n\n<p>\u3000\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u3042\u308b\u901a\u308a\u539f\u56e0\u306f\u6570\u5024\u304c\u7b26\u53f7\u4ed8\u304d\u3068\u89e3\u91c8\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3067\u3042\u308a\uff08\u6700\u4e0a\u4f4d\u30d3\u30c3\u30c8\uff08\u7b26\u53f7\u30d3\u30c3\u30c8\uff09\u304c1\u306a\u306e\u3067\uff09\u3001\u6587\u5b57\u5217\u3092\u7d4c\u7531\u3059\u308c\u3070\u826f\u3044\u3088\u3046\u3067\u3059<sup>[2]<\/sup>\u3002<\/p>\n\n\n\n<p>\u3000\u4ee5\u4e0b\u306e\u3088\u3046\u306b<code>0xC0000000<\/code>\u76f8\u5f53\u306e\u5024\u306e\u6587\u5b57\u5217\u3092<code>System.Convert::ToUInt32()<\/code>\u3067\u5909\u63db\u3057\u305f\u3068\u3053\u308d\u30a8\u30e9\u30fc\u306f\u51fa\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$AccessMask = \"3221225472\"; # = 0xC00000000 = GENERIC_READ (0x80000000) | GENERIC_WRITE (0x40000000)\n\n$DeviceHandle = $KernelService::CreateFile(\"\\\\.\\PhysicalDrive$PhyDrvNo\", &#91;System.Convert]::ToUInt32($AccessMask), $AccessMode, &#91;System.IntPtr]::Zero, $AccessEx, $AccessAttr, &#91;System.IntPtr]::Zero);<\/code><\/pre>\n\n\n\n<h4 id=\"outline__6_3_2\" class=\"wp-block-heading\"><a href=\"https:\/\/qiita.com\/ken-yossy\/items\/d87642c143c64ef82626#deviceiocontrol%E3%81%AE%E5%BC%95%E6%95%B0\"><\/a><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"><code>DeviceIoControl()<\/code>\u306e\u5f15\u6570<\/mark><\/h4>\n\n\n\n<p>\u30002\u3064\u76ee\u306f<code>DeviceIoControl()<\/code>\u306e\u5f15\u6570\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000<code>DeviceIoControl()<\/code>\u3092\u4f7f\u3046\u969b\u3001\u300c\u30c7\u30d0\u30a4\u30b9\u306b\u5bfe\u3057\u3066\u4f55\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3057\u305f\u3044\u306e\u304b\u300d\u3092\u307e\u3068\u3081\u305f\u69cb\u9020\u4f53\u3078\u306e\u30dd\u30a4\u30f3\u30bf\u3092\u6e21\u3059\u306e\u3067\u3059\u304c\u3001\u30e1\u30e2\u30ea\u306e\u78ba\u4fdd\u3084\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u8a2d\u5b9a\u306b\u60a9\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3000\u7d50\u5c40\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u69cb\u9020\u4f53\u3092\u5ba3\u8a00\u3057\u3001<code>New-Object<\/code>\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Add-Type -TypeDefinition @\"\nusing System;\nusing System.Runtime.InteropServices;\n&#91;StructLayout(LayoutKind.Sequential, Pack = 1)]\npublic struct NVMeStorageQueryProperty {\n    public UInt32 PropertyId;\n    public UInt32 QueryType;\n    public UInt32 ProtocolType;\n    public UInt32 DataType;\n    public UInt32 ProtocolDataRequestValue;\n    public UInt32 ProtocolDataRequestSubValue;\n    public UInt32 ProtocolDataOffset;\n    public UInt32 ProtocolDataLength;\n    public UInt32 FixedProtocolReturnData;\n    public UInt32 ProtocolDataRequestSubValue2;\n    public UInt32 ProtocolDataRequestSubValue3;\n    public UInt32 Reserved0;\n\n    &#91;MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)]\n    public Byte&#91;] SMARTData;\n}\n\"@<\/code><\/pre>\n\n\n\n<p>\u3000\u3053\u306e\u69cb\u9020\u4f53\u306e\u30e1\u30f3\u30d0\u306fC\u8a00\u8a9e\u5411\u3051\u306e\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u8eab\u3092\u898b\u3066\u6c7a\u3081\u305f\u3082\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u6700\u5f8c\u306e<code>SMARTData<\/code>\u3068\u3044\u3046\u30d0\u30a4\u30c8\u5217\u306f\u3001S.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u672c\u4f53\u304c\u683c\u7d0d\u3055\u308c\u308b\u30e1\u30e2\u30ea\u9818\u57df\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u5f53\u521d\u306fNVMe\u4ed5\u69d8\u3067\u5b9a\u7fa9\u3055\u308c\u305fS.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u306e\u4e2d\u8eab\u3092\u66f8\u304d\u4e0b\u3059\u3053\u3068\u3082\u8003\u3048\u305f\u306e\u3067\u3059\u304c\u3001\u9577\u304f\u3066\u53ef\u8aad\u6027\u304c\u60aa\u304f\u306a\u308b\u306e\u3068\u3001S.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u4ee5\u5916\u306e\u53d6\u5f97\u306b\u6d41\u7528\u3057\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u3001\u898f\u5b9a\u30b5\u30a4\u30ba\u306e\u30e1\u30e2\u30ea\u9818\u57df\u3092\u5b9a\u7fa9\u3059\u308b\u306e\u307f\u3068\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3000S.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u306e\u30b5\u30a4\u30ba\u306fNVMe\u4ed5\u69d8\u306b\u304a\u3044\u3066512\u30d0\u30a4\u30c8\u3068\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>&#91;MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)]<\/code><\/code><\/pre>\n\n\n\n<p>\u3068\u6307\u5b9a\u3057\u3001\u5fc5\u8981\u306a\u30b5\u30a4\u30ba\u306e\u30e1\u30e2\u30ea\u9818\u57df\u3092\u78ba\u4fdd\u3057\u307e\u3059<sup>[3]<\/sup>\u3002<\/p>\n\n\n\n<p>\u3000\u307e\u305f\u3001<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>&#91;StructLayout(LayoutKind.Sequential, Pack = 1)]<\/code><\/code><\/pre>\n\n\n\n<p>\u3068\u3044\u3046\u69cb\u9020\u4f53\u30e1\u30f3\u30d0\u306e\u30e1\u30e2\u30ea\u914d\u7f6e\u65b9\u6cd5\u6307\u5b9a\u3082\u5fc5\u8981\u3067\u3059<sup>[4]<\/sup>\u3002\u3053\u308c\u304c\u306a\u3044\u3068\u3001\u69cb\u9020\u4f53\u306e\u30b5\u30a4\u30ba\u304c\u671f\u5f85\u3057\u305f\u5024\u306b\u306a\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3000\u3053\u308c\u3067<code>DeviceIoControl()<\/code>\u7528\u306e\u69cb\u9020\u4f53\u3092\u5ba3\u8a00\u3057\u305f\u3089\u3001\u3042\u3068\u306f\u3053\u306e\u69cb\u9020\u4f53\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u3066\u3001S.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u306b\u5fc5\u8981\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3057\u3066C\u8a00\u8a9e\u3067\u5b9f\u88c5\u3057\u305f\u969b\u3068\u540c\u3058\u5024\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 id=\"outline__6_3_3\" class=\"wp-block-heading\"><a href=\"https:\/\/qiita.com\/ken-yossy\/items\/d87642c143c64ef82626#%E6%A7%8B%E9%80%A0%E4%BD%93%E3%81%AE%E3%83%9D%E3%82%A4%E3%83%B3%E3%82%BF%E3%82%92%E3%81%A9%E3%81%86%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B%E3%81%8B\"><\/a><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u69cb\u9020\u4f53\u306e\u30dd\u30a4\u30f3\u30bf\u3092\u3069\u3046\u53d6\u5f97\u3059\u308b\u304b<\/mark><\/h4>\n\n\n\n<p>\u3000\u69cb\u9020\u4f53\u3092\u5ba3\u8a00\u3057\u3001<code>New-Object<\/code>\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u3066\u30e1\u30f3\u30d0\uff08\u30d1\u30e9\u30e1\u30fc\u30bf\uff09\u3092\u8a2d\u5b9a\u3057\u305f\u3089\u3001\u3042\u3068\u306f\u3053\u308c\u3092<code>DeviceIoControl()<\/code>\u306e\u5f15\u6570\u3068\u3057\u3066\u6e21\u305b\u3070\u3088\u3044\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u969b\u300c\u69cb\u9020\u4f53\u3078\u306e\u30dd\u30a4\u30f3\u30bf\u300d\u3092\u6e21\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u300c\u69cb\u9020\u4f53\u306e\u30dd\u30a4\u30f3\u30bf\u300d\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u304c\u308f\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3000\u8abf\u3079\u305f\u7d50\u679c\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306bMarshal\u30af\u30e9\u30b9\u306e\u30e1\u30bd\u30c3\u30c9<code>Marshal::StructureToPtr()<\/code>\u3092\u4f7f\u3048\u3070\u826f\u3044\u3088\u3046\u3067\u3059<sup>[5]<\/sup>\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$OutBuffer     = &#91;System.Runtime.InteropServices.Marshal]::AllocHGlobal($OutBufferSize);\n\n&#91;System.Runtime.InteropServices.Marshal]::StructureToPtr($Property, $OutBuffer, &#91;System.Boolean]::false);\n$CallResult = $KernelService::DeviceIoControl($DeviceHandle, $IoControlCode, $OutBuffer, $OutBufferSize, $OutBuffer, $OutBufferSize, &#91;ref]$ByteRet, &#91;System.IntPtr]::Zero);<\/code><\/pre>\n\n\n\n<p>\u3000\u3053\u306e\u3084\u308a\u304b\u305f\u306f\u300c\u4f5c\u6210\u3057\u305f\u69cb\u9020\u4f53\u306e\u30dd\u30a4\u30f3\u30bf\u3092\u53d6\u5f97\u3059\u308b\u300d\u306e\u3067\u306f\u306a\u304f\u300c\u4e88\u3081\u78ba\u4fdd\u3057\u3066\u304a\u3044\u305f\u30e1\u30e2\u30ea\u9818\u57df\u3078\u69cb\u9020\u4f53\u306e\u5185\u5bb9\u3092\u30b3\u30d4\u30fc\u300d\u3057\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h3 id=\"outline__6_4\" class=\"wp-block-heading\"><a href=\"https:\/\/qiita.com\/ken-yossy\/items\/d87642c143c64ef82626#smart%E3%83%AD%E3%82%B0%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B\"><\/a><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">S.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b<\/mark><\/h3>\n\n\n\n<p>\u3000<code>DeviceIoControl()<\/code>\u306e\u547c\u3073\u51fa\u3057\u304c\u6210\u529f\u3059\u308b\u3068\u3001\u5148\u307b\u3069<code>DeviceIoControl()<\/code>\u306b\u6e21\u3057\u305f\u30dd\u30a4\u30f3\u30bf\u304c\u6307\u3059\u30e1\u30e2\u30ea\u9818\u57df\u306bS.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u304c\u683c\u7d0d\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u3068\u306f\u3044\u3048<code>DeviceIoControl()<\/code>\u306b\u6e21\u3057\u305f\u30dd\u30a4\u30f3\u30bf\u304c\u6307\u3059\u30e1\u30e2\u30ea\u9818\u57df\u306f\u305f\u3060\u306e\u30d0\u30a4\u30c8\u5217\u3068\u3057\u3066\u78ba\u4fdd\u3057\u305f\u9818\u57df\u3067\u3059\u306e\u3067\u3001\u3053\u306e\u307e\u307e\u3067\u306f\u69cb\u9020\u4f53\u3084\u30af\u30e9\u30b9\u306e\u3088\u3046\u306b\u306f\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p>\u3000\u5148\u307b\u3069\u3068\u306f\u9006\u306b\u3001\u30dd\u30a4\u30f3\u30bf\u304c\u6307\u3059\uff08\u305f\u3060\u306e\u30d0\u30a4\u30c8\u5217\u306e\uff09\u30e1\u30e2\u30ea\u9818\u57df\u306e\u5185\u5bb9\u3092\u69cb\u9020\u4f53\u306b\u30b3\u30d4\u30fc\u3059\u308b\u3001\u3068\u3044\u3046\u65b9\u6cd5\u3082\u3042\u308b\u3088\u3046\u3067\u3059\u304c\u3001\u9762\u5012\u3067\u3059\u306e\u3067\u3001\u30dd\u30a4\u30f3\u30bf\u3068\u30aa\u30d5\u30bb\u30c3\u30c8\u3092\u7528\u3044\u3066\u76f4\u63a5\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3000\u306a\u304a\u3001\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u3067<code>Write-Output<\/code>\u3057\u3066\u3044\u308b\u306e\u306f\u753b\u9762\u51fa\u529b\u306e\u305f\u3081\u3067\u3042\u308a\u3001\u3053\u3053\u3067\u306e\u30dd\u30a4\u30f3\u30c8\u306f<code>Marshal::ReadInt16()<\/code>\u306a\u3069\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Write-Output( \"Composite Temperature: {0} (K)\" -F &#91;System.Runtime.InteropServices.Marshal]::ReadInt16($OutBuffer, 49) );\nWrite-Output( \"Available Spare: {0} (%)\" -F &#91;System.Runtime.InteropServices.Marshal]::ReadByte($OutBuffer, 51) );\nWrite-Output( \"Available Spare Threshold: {0} (%)\" -F &#91;System.Runtime.InteropServices.Marshal]::ReadByte($OutBuffer, 52) );<\/code><\/pre>\n\n\n\n<p>\u3000<code>Marshal::ReadInt16()<\/code>\u306f\u6307\u5b9a\u4f4d\u7f6e\u304b\u308916\u30d3\u30c3\u30c8\uff082\u30d0\u30a4\u30c8\uff09\u306e\u30c7\u30fc\u30bf\u3092\u7b26\u53f7\u4ed8\u304d\u6574\u6570\u3068\u3057\u3066\u8aad\u307f\u53d6\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3001<code>Marshal::ReadByte()<\/code>\u306f\u6307\u5b9a\u4f4d\u7f6e\u304b\u30891\u30d0\u30a4\u30c8\u8aad\u307f\u53d6\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u3053\u308c\u3089\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u30e1\u30e2\u30ea\u9818\u57df\u306e\u5148\u982d\u3078\u306e\u30dd\u30a4\u30f3\u30bf\u3068\u30aa\u30d5\u30bb\u30c3\u30c8\u3060\u3051\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u3001\u3068\u3066\u3082\u4f7f\u3044\u52dd\u624b\u304c\u826f\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u3053\u306e\u65b9\u6cd5\u306f\u3001S.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u306e\u30c7\u30fc\u30bf\u69cb\u9020\uff08\u5404\u30c7\u30fc\u30bf\u306e\u30b5\u30a4\u30ba\u3068\u914d\u7f6e\uff09\u304cNVMe\u4ed5\u69d8\u3067\u898f\u5b9a\u3055\u308c\u3066\u3044\u308b\u304b\u3089\u3053\u305d\u63a1\u7528\u3067\u304d\u308b\u65b9\u6cd5\u3067\u3059\u3002\u3000<\/p>\n\n\n\n<h2 id=\"outline__7\" class=\"wp-block-heading\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u3055\u3044\u3054\u306b<\/mark><\/h2>\n\n\n\n<p>\u3000\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001PowerShell\u30b9\u30af\u30ea\u30d7\u30c8\u3060\u3051\u3067NVMe\u30c9\u30e9\u30a4\u30d6\u304b\u3089S.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u3064\u3044\u3066\u3001\u4f7f\u3044\u304b\u305f\u3092\u3054\u8aac\u660e\u3057\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30dd\u30a4\u30f3\u30c8\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3000\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5fdc\u7528\u3059\u308b\u3068\u3001Windows\u3067\u904b\u7528\u3057\u3066\u3044\u308bNVMe\u30c9\u30e9\u30a4\u30d6\u306b\u5bfe\u3057\u3066\u3001S.M.A.R.T.\u30ed\u30b0\u30c7\u30fc\u30bf\u4ee5\u5916\u306e\u60c5\u5831\uff08\u4f8b\uff1a<code>Identify<\/code>\u30c7\u30fc\u30bf\uff09\u306e\u53d6\u5f97\u3084\u7279\u5b9a\u306e\u5024\u306e\u307f\u306e\uff08\u81ea\u52d5\uff09\u76e3\u8996\u3001\u3055\u3089\u306b\u306f\u30c7\u30fc\u30bf\u306e\u84c4\u7a4d\u3001\u306a\u3069\u304c\u53ef\u80fd\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 id=\"outline__8\" class=\"wp-block-heading\"><a href=\"https:\/\/qiita.com\/ken-yossy\/items\/d87642c143c64ef82626#references\"><\/a><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">References<\/mark><\/h2>\n\n\n\n<p>[1] &#8220;<em><a rel=\"noreferrer noopener\" href=\"https:\/\/www.reddit.com\/r\/PowerShell\/comments\/b2wenl\/using_deviceiocontrol_and_fsctl_srv_enumerate\/\" target=\"_blank\">Using DeviceIoControl and FSCTL_SRV_ENUMERATE_SNAPSHOTS in PowerShell<\/a><\/em>&#8220;\u30012023\u5e742\u67087\u65e5\u95b2\u89a7<br>[2] MURA\u3001\u300c<em><a rel=\"noreferrer noopener\" href=\"http:\/\/www.vwnet.jp\/Windows\/PowerShell\/2020111001\/SetUnit32Max.htm\" target=\"_blank\">PowerShell \u3067 UInt32 \u306b\u6700\u5927\u5024\u3092\u30bb\u30c3\u30c8\u3059\u308b<\/a><\/em>\u300d\u30012023\u5e742\u67087\u65e5\u95b2\u89a7<br>[3] Microsoft\u3001<em>&#8220;<a rel=\"noreferrer noopener\" href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/standard\/native-interop\/customize-struct-marshaling\" target=\"_blank\">Customize structure marshaling<\/a>&#8220;<\/em>\u30012023\u5e742\u67087\u65e5\u95b2\u89a7<br>[4] Microsoft\u3001<em>&#8220;<a rel=\"noreferrer noopener\" href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.runtime.interopservices.structlayoutattribute.pack?view=net-5.0\" target=\"_blank\">StructLayoutAttribute.Pack Field<\/a>&#8220;<\/em>\u30012023\u5e742\u67087\u65e5\u95b2\u89a7<br>[5] Microsoft\u3001<em>&#8220;<a rel=\"noreferrer noopener\" href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.runtime.interopservices.marshal.structuretoptr?view=net-5.0\" target=\"_blank\">Marshal.StructureToPtr Method<\/a>&#8220;<\/em>\u30012023\u5e742\u67087\u65e5\u95b2\u89a7<\/p>\n\n\n\n<p><a href=\"https:\/\/qiita.com\/ken-yossy\/items\/d87642c143c64ef82626#%E3%83%A9%E3%82%A4%E3%82%BB%E3%83%B3%E3%82%B9%E8%A1%A8%E8%A8%98\"><\/a><\/p>\n\n\n\n<p style=\"font-size:12px\">\u4ed6\u793e\u5546\u6a19\u306b\u3064\u3044\u3066<br>\u8a18\u4e8b\u4e2d\u306b\u306f\u767b\u9332\u5546\u6a19\u30de\u30fc\u30af\u3092\u660e\u8a18\u3057\u3066\u304a\u308a\u307e\u305b\u3093\u304c\u3001\u8a18\u4e8b\u306b\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u4f1a\u793e\u540d\u304a\u3088\u3073\u88fd\u54c1\u540d\u7b49\u306f\u4e00\u822c\u306b\u5404\u793e\u306e\u5546\u6a19\u307e\u305f\u306f\u767b\u9332\u5546\u6a19\u3067\u3059\u3002<\/p>\n\n\n\n<p style=\"font-size:12px\">\u8a18\u4e8b\u5185\u5bb9\u306b\u3064\u3044\u3066<br>\u3053\u306e\u8a18\u4e8b\u306e\u5185\u5bb9\u306f\u3001\u767a\u8868\u5f53\u6642\u306e\u60c5\u5831\u3067\u3059\u3002\u4e88\u544a\u306a\u304f\u5909\u66f4\u3055\u308c\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u3042\u3089\u304b\u3058\u3081\u3054\u4e86\u627f\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 id=\"outline__9\" class=\"wp-block-heading\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u304a\u554f\u3044\u5408\u308f\u305b<\/mark><\/h2>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-50\"><a class=\"wp-block-button__link has-white-color has-vivid-cyan-blue-background-color has-text-color has-background wp-element-button\" href=\"https:\/\/testhagisolcojp.gptw.net\/form\/contact.php\"><strong>\u304a\u554f\u3044\u5408\u308f\u305b\u306f\u3053\u3061\u3089<\/strong><\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Windows\u3067\u5229\u7528\u53ef\u80fd\u306aPowerShell\u3092\u7528\u3044\u3066NVMe SSD\u306eS.M.A.R.T.\u30ed\u30b0\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":4,"featured_media":1973,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[23,35],"class_list":["post-1952","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-reliability","tag-nvme-ssd","tag-35"],"_links":{"self":[{"href":"https:\/\/testhagisolcojp.gptw.net\/techblog\/index.php?rest_route=\/wp\/v2\/posts\/1952","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/testhagisolcojp.gptw.net\/techblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/testhagisolcojp.gptw.net\/techblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/testhagisolcojp.gptw.net\/techblog\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/testhagisolcojp.gptw.net\/techblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1952"}],"version-history":[{"count":52,"href":"https:\/\/testhagisolcojp.gptw.net\/techblog\/index.php?rest_route=\/wp\/v2\/posts\/1952\/revisions"}],"predecessor-version":[{"id":4195,"href":"https:\/\/testhagisolcojp.gptw.net\/techblog\/index.php?rest_route=\/wp\/v2\/posts\/1952\/revisions\/4195"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/testhagisolcojp.gptw.net\/techblog\/index.php?rest_route=\/wp\/v2\/media\/1973"}],"wp:attachment":[{"href":"https:\/\/testhagisolcojp.gptw.net\/techblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/testhagisolcojp.gptw.net\/techblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/testhagisolcojp.gptw.net\/techblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}