$in = Get-ChildItem $src | % { $_.fullname }
$out = Get-ChildItem $src | % { $_.Name }
$src = Get-ChildItem -r B:\backup\ -include *.xls | Where-Object {$_.LastWriteTime -ge [datetime]::Today.AddHours(-24)}
cd r:\test
$key = "l:\key\key.bin"
foreach($item in $src){
& 'C:\Program Files (x86)\OpenSSL\bin\openssl.exe' enc -e -aes-256-cbc -kfile $key -in $item.fullname -out $item.name
}
invoke-command -ComputerName DESKTOP-H287B33 -ScriptBlock {cmd /c 'c:\users\user\desktop\Opera_65.0.3467.48_Setup.exe /SILENT'}
/SILENT /norestart /allusers=yes /launchopera=no /desktopshortcut=no /setdefaultbrowser=no /pintotaskbar=no
$source_path = "D:\TOOLS"
$destination_path = "E:\TOOLS"
Copy-Item -Path "$source_path\*" -Recurse -Destination $destination_path -Force
$source_path_list = Get-ChildItem $source_path -Force -File -Recurse
$problematic_files = $null
foreach($file in $source_path_list)
{
$source_filehash = Get-FileHash -Algorithm MD5 $file.FullName #тут была ошибка
$destination_filehash = Get-FileHash -Algorithm MD5 ($file.FullName -replace "^D:","E:") #вот так делать просто низко!
if($source_filehash.Hash -eq $destination_filehash.Hash)
{
write-host $file.FullName -ForegroundColor Green
}
else
{
write-host "Source and destination hashes for $($file.FullName) do not match!" -ForegroundColor Red
Read-host "Нажмите Enter чтобы продолжить"
$problematic_files += $file.FullName
}
}
"Problematic files detected: $problematic_files"
(New-Object -ComObject WScript.Shell).AppActivate((get-process | where MainWindowTitle -match "имя_окна").MainWindowTitle)
Add-Type -path путь_к_BouncyCastle.Crypto.dll