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
Invoke-Command -FilePath ....
function foo {
param($a)
"I'm a FOO func on $($env:COMPUTERNAME)- $a"
}
function bar {
param($a)
"I'm a BAR func on $($env:COMPUTERNAME)- $a"
}
# variant 1
$foo = $function:foo
Invoke-Command -ComputerName REMOTE {
Set-Content function:foo $using:foo
foo 'aaa'
}
#variant 2
Invoke-Command -ComputerName REMOTE {
param($bar)
Set-Content function:bar $bar
bar 'aaa'
} -ArgumentList $function:bar