$_ -replace "@sn", $AD_user.sn `
-replace "@givenName", $AD_user.givenName `
-replace "@Title", $AD_user.Title `
-replace "@Company", $AD_user.Company `
-replace "@homePhone", $AD_user.homePhone `
-replace "@ipPhone", $AD_user.telephoneNumber
} | Set-Content "$PathSignatureUser\$FileName.$Ext"[ADSI]$NTAccount = [System.Security.Principal.NTAccount]::new($env:username)
$sid = $NTAccount.Translate([System.Security.Principal.SecurityIdentifier]).Value
$User = [adsi]"LDAP://<SID=$sid>"
$User.DisplayName set a=%1%
echo %a:~7,-1%
pauseвот тут уже видно, что в a всё вырезано, можно запускать вместо echoЗначение нуля означает, что время последнего входа неизвестно.
$oldfile = Get-FileHash .\old\*
$newfile = Get-FileHash .\new\*
Compare-Object $oldfile $newfile -Property Hash -PassThru |
Where-Object { $_.SideIndicator -eq '<=' } |
Foreach-Object { Copy-Item $_.Path -Destination $Destination }$oldfile = Get-ChildItem .\old\* -Recurse | Get-FileHash
$newfile = Get-ChildItem .\new\* -Recurse | Get-FileHash robocopy \\%computername%\c$\logs \\server\logs\%computername%\logs /e$computers =get-content 'c:\computers.txt'
foreach ($computername in $computers) {
robocopy "\\$computername\c`$\logs" "\\server\logs\$computername\logs" /e
}for /f %%a in (c:\computers.txt) do robocopy \\%%a\c`$\logs \\server\logs\%%a\logs /e $global:log = New-Object System.Collections.ArrayList
$testobj = New-Object -TypeName System.Diagnostics.EventLog
$testobj.Log = "Security"
Register-ObjectEvent -InputObject $testobj -EventName EntryWritten -Action {
param($sender, $e)
[void]$global:log.Add([PSCustomObject]@{Sender = $sender; Args = $e })
}
# Смотреть потом события в переменной
$global:log/ip dhcp-server lease add address=1.2.3.4 mac-address=112233445566$SMTPClient.EnableSsl = $true[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12