{"id":23283829,"url":"https://github.com/showgayaki/send-cdi-smart","last_synced_at":"2025-08-02T00:04:13.614Z","repository":{"id":165890282,"uuid":"635097009","full_name":"showgayaki/send-cdi-smart","owner":"showgayaki","description":"CrystalDiskInfoで取得したS.M.A.R.T.情報をメールで送りたいんです","archived":false,"fork":false,"pushed_at":"2023-05-22T09:39:51.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T14:47:42.520Z","etag":null,"topics":["crystaldiskinfo","powershell"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/showgayaki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-02T00:46:54.000Z","updated_at":"2024-06-09T00:46:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"89303339-ea8e-4534-bfb3-76decb063a72","html_url":"https://github.com/showgayaki/send-cdi-smart","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/showgayaki/send-cdi-smart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/showgayaki%2Fsend-cdi-smart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/showgayaki%2Fsend-cdi-smart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/showgayaki%2Fsend-cdi-smart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/showgayaki%2Fsend-cdi-smart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/showgayaki","download_url":"https://codeload.github.com/showgayaki/send-cdi-smart/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/showgayaki%2Fsend-cdi-smart/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268315819,"owners_count":24231057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crystaldiskinfo","powershell"],"created_at":"2024-12-20T01:33:03.354Z","updated_at":"2025-08-02T00:04:13.559Z","avatar_url":"https://github.com/showgayaki.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# send-cdi-smart\r\n[CrystalDiskInfo](https://crystalmark.info/ja/software/crystaldiskinfo/)で取得したS.M.A.R.T.情報をメールで送信する。  \r\n[CrystalDiskInfoのコマンドライン](https://crystalmark.info/ja/software/crystaldiskinfo/crystaldiskinfo-advanced-features/)を利用。\r\n\r\n\r\n## 環境\r\n`$PSVersionTable`  \r\n```\r\nName                           Value\r\n----                           -----\r\nPSVersion                      7.3.4\r\nPSEdition                      Core\r\nGitCommitId                    7.3.4\r\nOS                             Microsoft Windows 10.0.22621\r\nPlatform                       Win32NT\r\nPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion      2.3\r\nSerializationVersion           1.1.0.1\r\nWSManStackVersion              3.0\r\n```\r\n\r\n## ライブラリインストール\r\nSmtpClientは[廃止](https://learn.microsoft.com/ja-jp/dotnet/api/system.net.mail.smtpclient?view=net-7.0#remarks)だそうなので、代わりにMailKitとMimeKitを使う。  \r\n\r\n以下のコマンドを実行してインストール。  \r\n`Install-Package -name \"MimeKit\" -Source \"https://www.nuget.org/api/v2\" -SkipDependencies`  \r\n`Install-Package -name \"MailKit\" -Source \"https://www.nuget.org/api/v2\"`  \r\n\r\n参考動画：[PowerShell Tutorials : Send an email using MailKit](https://www.youtube.com/watch?v=wy5vs0gEei0)\r\n\r\n\r\n## config.json\r\nconfig.json.sampleにメール情報を記載してconfig.jsonにリネーム。  \r\n以下はサンプル\r\n```\r\n{\r\n    \"CDI_DIRECTORY\": \"C:\\\\Program Files\\\\CrystalDiskInfo\",\r\n    \"CDI_EXE_FILE\": \"DiskInfo64.exe\",\r\n    \"CDI_OPTION\": \"/CopyExit\",\r\n    \"MAIL\": {\r\n        \"SMTP_SERVER\": \"smtp.gmail.com\",\r\n        \"SMTP_PORT\": 587,\r\n        \"SMTP_USER\": \"soushinmoto-email-address\",\r\n        \"SMTP_PASS\": \"soushinmoto-email-password\",\r\n        \"TO\": \"okuritai-email-address\"\r\n    },\r\n    \"MAIL_LIBRARIES\": {\r\n        \"MAIL_KIT\": \"C:\\\\Program Files\\\\PackageManagement\\\\NuGet\\\\Packages\\\\MailKit.4.0.0\\\\lib\\\\netstandard2.0\\\\MailKit.dll\",\r\n        \"MIME_KIT\": \"C:\\\\Program Files\\\\PackageManagement\\\\NuGet\\\\Packages\\\\MimeKit.4.0.0\\\\lib\\\\netstandard2.0\\\\MimeKit.dll\"\r\n    }\r\n}\r\n```\r\n\r\n## タスクスケジューラに登録\r\n### 全般\r\n- [x] ユーザーがログオンしているかどうかにかかわらず実行する\r\n- [x] 最上位の特権で実行する\r\n\r\n- 構成：Windows 10\r\n\r\n### 　トリガー\r\n実行したい時間に適当に\r\n\r\n### 操作\r\n新規  \r\n- プログラムの開始\r\n- プログラム/スクリプト： `\"C:\\Program Files\\PowerShell\\7\\pwsh.exe\"`\r\n- 引数の追加（オプション）： `-ExecutionPolicy RemoteSigned -File \"run.ps1\"`\r\n- 開始（オプション）： `D:\\Projects\\send-cdi-smart`\r\n\r\n\r\n## メールサンプル\r\n![mail-sample](https://github.com/showgayaki/send-cdi-smart/assets/47170845/6ac35ec3-8110-4bc3-8cb9-151adb4e2fcb)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshowgayaki%2Fsend-cdi-smart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshowgayaki%2Fsend-cdi-smart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshowgayaki%2Fsend-cdi-smart/lists"}