Start-Process helloworld.exe
From the ntstatus.h SDK header file:
//
// MessageId: STATUS_DLL_NOT_FOUND
//
// MessageText:
//
// The program can't start because %hs is missing from your computer.
// Try reinstalling the program to fix this problem.
//
#define STATUS_DLL_NOT_FOUND ((NTSTATUS)0xC0000135L) // winnt
Get-ADUser IIvanov -prop AccountExpirationDate, accountExpires
AccountExpirationDate : 05.10.2022 0:00:00
accountExpires : 133093908000000000
# Как делаете вы
Get-Date 133093908000000000 -UFormat '%Y.%m.%d'
0422.10.04
# Что там на самом деле вы должны были увидеть
Get-Date 133093908000000000
4 октября 0422 г. 21:00:00
# Как делаю я
[datetime]::FromFileTime(133093908000000000)
5 октября 2022 г. 0:00:00
# Что великолепно совпадает с AccountExpirationDate, который я и рекомендую
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
[System.BitConverter]::ToSingle(@(0xcd,0xcc,0x4c,0x41),0)
12,8
$usb = Get-ChildItem -path HKLM:\SYSTEM\ControlSet001\Enum\USB\ -Recurse
$usb | Where-Object { $_.GetValue('Address') -eq 4 }
$usb[1].<Ctrl+Space>
Get-Member -InputObject $usb[1]
$x = 'test'
psexec \\server powershell -NoProfile -Сommand "write-host '$X'"
psexec \\server powershell -NoProfile -Command "param(`$a) write-host `$a" $x
New-ItemProperty -LiteralPath HKCR:\Microsoft.PowerShellScript.1\Shell\runas\command -Name '(Default)' -Value 'powershell.exe -NoExit -Command "if((Get-ExecutionPolicy ) -ne ''AllSigned'') { Set-ExecutionPolicy -Scope Process Bypass }; & ''%1''"' -PropertyType String -Force | Out-Null;
#А вообще пароль проще запросить
$cred = get-credential
#и использовать
Import-ExchangeCertificate -FileName "C:\mail\mail.pfx" -Password $cred.Password
Invoke-Command -ComputerName $computer { C:\Temp\Install.exe /S }
$session = New-PSSession -ComputerName $computer
Invoke-Command -Session $session { C:\Temp\Install.exe /S }
Invoke-Command -Session $session { C:\Temp\Install2.exe /S }
$Date = get-date -Format "yyyy-MM-dd"
Get-ChildItem -Path "I:\BACKUP\File_$Date*.bak"
# Если непременно надо подчёркивание, то переменную придётся выделить
# Get-ChildItem -Path "I:\BACKUP\File_$($Date)_*.bak"
$folders = 'E:\BASE\enm*\pm*','F:\DATE\enm*\pm*'
$send_mail = $false
Get-ChildItem -force $folders -ErrorAction SilentlyContinue | Where-Object { $_ -is [io.directoryinfo] } | ForEach-Object {
$len = 0
Get-ChildItem -recurse -force $_.fullname -ErrorAction SilentlyContinue | ForEach-Object { $len += $_.length }
$colors = @{$False='black'; $True='red'}
$_.fullname+' - ', '<font color="{1}">{0:N2} Gb</font>' -f ($len / 1Gb), $colors[$len -ge 3Gb]
if ($len -ge 3Gb) {
$send_mail = $True
}
} | Tee-Object -Variable body
if ($send_mail)
{
Send-MailMessage-From 'test@test.ru' -To 'test@test.ru', -Subject "enm size" -BodyAsHtml ($Body -join "<br>`r`n") –SmtpServer '10.10.10.10'
}