2019-01-01から1年間の記事一覧
Powershellでメールを送信するコードです。 監視系で使えると思います。 必要事項を適宜変更すればコピペで使えると思います。 $mail.ReplyTo = $replytoはコメントアウトしてもよいかもしれません。 Param([int] $ret)$smtp = "smtp.example.co.jp"$targets…
※OutlookVBA Private Declare PtrSafe Function AddClipboardFormatListener Lib "user32.dll" (ByVal hWnd As LongPtr) As LongPrivate Declare PtrSafe Sub sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long) Private Declare PtrSafe F…
VBAといえばExcelしかないみたいにExcelVBAのことがたくさん出できますが、 OutlookやPowerPointだってOffice製品なのでVBAがあります。 でも、ほぼ検索できません。 今回、ExcelVBAで動いていたコードをOutlookに移すことになりましたが、 Application.Wait…
#get_dir.ps1 $FilePath = "C:\Users\Admin\cred.sec"$Username = "Admin" $result = Test-Path $FilePath if(!($result)){ $msgBoxInput = [System.Windows.MessageBox]::Show('[.sec]ファイルが見当たりません。credential.ps1を実行しますか?いいえを選…
$a = [Math]::Round($b/$c*100, 2, [MidpointRounding]::AwayFromZero);"空き容量" + [string]$a + "%"
#makeCredential.ps1 $FilePath = "C:\Users\Admin\cred.sec"$Credential = Get-Credential$Credential.Password | ConvertFrom-SecureString | Set-Content $FilePath #get_dir.ps1 $FilePath = "C:\Users\Admin\cred.sec"$Username = "Admin" #.secファイ…
$arr_str.GetType()if ($arr_str.gettype().name -eq "Int64"){Write-Host "OK"}else{Write-Host "NG"}
#閾値$shiki_chi = 90#ドライブ全体の容量カンマなしバイトで記載$max_map = 2948501864448 $arr_str = cmd /c dir \\fsv01\sv01 | findstr "バイトの空き領域"$arr_str = $arr_str.Split(" ")$arr_str = $arr_str[17]$arr_str = $arr_str.replace(",","")$a…
Set-ExecutionPolicy Bypass なにもブロックされなくなるのでセキュリティは最弱になります。 自己責任で。
$list = @("ACDaemon","AdobeActiveFile","AdobeARMservice","AdobeFlashPlaye","AeLookupSvc","ALG","AppIDSvc","Appinfo","AppleMobileDe","AppMgmt")Get-Service | where-object { $_.name -in $list }
if (@("りんご", "いちご", "トマト") -contains "トマト") { Write-Output "赤" }else{ Write-Output "ちがいまんな" }
$str_path = (Convert-Path .) Write-Host $str_path $array = @(Get-childItem -Name -include *.ttl | ForEach-Object -Process { $str_path + "\" + $_}) foreach ($a in $array){ & 'C:\Program Files (x86)\teraterm\ttpmacro.exe' $a 10.100.100.10 sa…