Skip to content

Instantly share code, notes, and snippets.

@azechi
Created February 21, 2013 09:06
Show Gist options
  • Save azechi/6162f993627ac0176495 to your computer and use it in GitHub Desktop.
Save azechi/6162f993627ac0176495 to your computer and use it in GitHub Desktop.
Xmailの凍結メッセージ処理
function func()
{
param ( $msgfile, [int]$lev0, [int]$lev1, [string] $from, [string]$to, [datetime] $date)
$base = $spool | Join-Path -ChildPath $lev0 | Join-Path -ChildPath $lev1
# メッセージ
$base | Join-Path -ChildPath "froz" | Join-Path -ChildPath $msgfile | Copy-Item
# ログ
$base | Join-Path -ChildPath "slog" | Join-Path -ChildPath $msgfile | Copy-Item -Destination "$msgfile.log"
# 削除
&$cmd -s localhost -u $user -p $password frozdel $lev0 $lev1 $msgfile
}
# カレントフォルダにすべての凍結メッセージとその理由を保存して、スプールから削除する
$cmd = "E:\Xmail\ctrlclnt.exe"
$spool = "E:\Xmail\MailRoot\spool"
# xmailサービスに登録してある管理ユーザー (windowsアカウントではない)
$user = "username"
$password = "password"
$list = @(&$cmd -s localhost -u $user -p $password frozlist)
[System.IO.Directory]::CreateDirectory($(Join-Path $(pwd) $("{0:yyyyMMdd}" -f [System.DateTime]::Now))) | cd
$list | % { Invoke-Expression "func $_" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment