# 1 вариант получения адресов, в конце отфильтровываем ipv6
$ip = (gwmi Win32_NetworkAdapterConfiguration -Filter IPEnabled=$true).IPAddress -match '\d+\.\d+\.'
# 2 вариант получения адресов, отфильтровываем ipv6 и 127.0.0.1
$ip = (Get-NetIPAddress | ? {$_. AddressFamily -eq 'IPv4' -and $_.IPAddress -ne '127.0.0.1' }).IPAddress
# Формирование строки
$port = 8001
$lines = $ip | Foreach-Object {
"socks -n -a -i127.0.0.1 -e$_ -p$port"
$port++
}
# Вывод в файл
'auth none', 'log', $lines | Out-File -Encoding Ascii -FilePath 'd:\111'
Get-Content C:\temp\users.csv |
Get-ADUser |
Select-Object name, samaccountname |
export-csv C:\1.csv -NoType -UseCulture -Encoding UTF8
& "C:\Program Files\7-Zip\7zG.exe" a C:\Users\Admin\full.7z -r C:\Users\Admin\test\
$create = & "C:\............
get-childitem -Recurse | Sort-Object -Descending -Property length | Select -First 1 -ExpandProperty Length
Import-Module "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"
#[timezoneinfo]::Utc необходим чтобы при загрузке сообщений не получать ошибку "The specified time zone isn't valid."
$EWS = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService 'Exchange2013',([timezoneinfo]::Utc)
$EWS.AutodiscoverUrl('youremail@example.com')
$email = [Microsoft.Exchange.WebServices.Data.EmailMessage]($EWS)
[void]$email.ToRecipients.Add('someaddress@example.com')
$email.Subject = 'test mail'
$email.Body = 'This is the first email I''ve sent by using the EWS Managed API'
# Enable XML trace
$EWS.TraceEnabled = $true
$EWS.TraceFlags = 'All'
$email.Send()
#$email.SendAndSaveCopy()
# поиск
$inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($EWS,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox)
$mailitems = $inbox.FindItems(10)
$mailitems | ForEach {$_.Load()}
$mailitems | Select Sender,Subject,Body