PS C:\Windows\system32> get-printer
Name ComputerName Type DriverName PortName Shared Published DeviceType
---- ------------ ---- ---------- -------- ------ --------- ----------
Printer-BADC Local Samsung Universal Prin... WSD-b2a188e9... False False Print
Microsoft XPS Document Writer Local Microsoft XPS Document... PORTPROMPT: False False Print
Microsoft Print to PDF Local Microsoft Print To PDF PORTPROMPT: False False Print
Fax Local Microsoft Shared Fax D... SHRFAX: False False Print
PS C:\Windows\system32> get-printer | where name -match "print"
Name ComputerName Type DriverName PortName Shared Published DeviceType
---- ------------ ---- ---------- -------- ------ --------- ----------
Printer-BADC Local Samsung Universal Prin... WSD-b2a188e9... False False Print
Microsoft Print to PDF Local Microsoft Print To PDF PORTPROMPT: False False Print
PS C:\Windows\system32> get-printer | where name -match "print" | remove-printer
PS C:\Windows\system32> get-printer
Name ComputerName Type DriverName PortName Shared Published DeviceType
---- ------------ ---- ---------- -------- ------ --------- ----------
Microsoft XPS Document Writer Local Microsoft XPS Document... PORTPROMPT: False False Print
Fax Local Microsoft Shared Fax D... SHRFAX: False False Print
$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"