Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Пользователь


Сообщения: 138
Благодарности: 7

Профиль | Отправить PM | Цитировать


сделал следующий скрипт, вдруг кому то понадобиться.


Код: Выделить весь код
$user = Import-Csv \\dc01.domain.lan\migratereport$\emailaddress.txt | where  `
{$_.samaccountname -eq "$env:username"}
if ($user) {break} 
       else  { 
$mail = New-Object -ComObject Outlook.Application
$accounts = $mail.session.accounts | %{Write-Output $_.smtpaddress}
if (($accounts | measure).count -eq '1') {
$env:username+','+$accounts  | Add-Content -Path `
 \\dc01.domain.lan\migratereport$\emailaddress.txt }  
elseif (($accounts | measure).count -eq '2') {
$env:username+','+$accounts[0]+','+$accounts[1] | Add-Content -Path `
\\domain.lan\migratereport$\emailaddress.txt}
else {
$env:username+','+'null' | Add-Content -Path `
 \\dc01.domain.lan\migratereport$\emailaddress.txt}
(Get-Process outlook*).kill()
}

-------
MCP : 70-270 , 70-290 , 70-291, 70-685


Отправлено: 17:06, 29-08-2014 | #2