本題
Windows11の設定が面倒なので自動化する。結果をメール送信する。
設定
- メール送信準備
- Set-ExecutionPolicy RemoteSigned
- $to = "recipient@gmail.com"
$from = "your-email@gmail.com"
$subject = "Test Email from PowerShell"
$body = "This is a test email sent from PowerShell using Gmail SMTP server."
$smtpServer = "smtp.gmail.com"
$port = 587
$credential = Get-Credential - パスワード 最低10文字以上
- Get-LocalSecurityPolicy
- Set-LocalSecurityPolicy -MinimumPasswordLength 10
- あああ
- あああ
- あああ
- あああ
- あああ
- あああ
- あああ
- メール送信
- Send-MailMessage -To $to -From $from -Subject $subject -Body $body -SmtpServer $smtpServer -Port $port -UseSsl -Credential $credential
コメント
コメントを投稿