[Windows.Graphics.Capture.GraphicsCaptureSession, Windows.Graphics.Capture, ContentType=WindowsRuntime] | Out-Null
[Windows.Graphics.Capture.GraphicsCaptureSession]::IsBorderRequired = $true$folders = Get-ChildItem -Path C:\ -Directory -Recurse | ForEach-Object {
[PSCustomObject]@{
Path=$_.FullName
Count=$_.FullName | Get-ChildItem -File | Measure-Object | Select-Object -ExpandProperty Count
}
} | Sort-Object Count -Descending
# Посмотреть потом первый десяток:
$folders | Select -First 10$Error.Clear()
Get-ChildItem C:\ -Recurse -ErrorAction Continue | Out-Null
$err = $Error | ForEach-Object { $_.TargetObject }После этого в переменной $err будет список папок, на которые выдавались ошибки.$err | Set-Content -Path d:\Path_without_access.txt -Encoding UTF8PS> Get-Command -Module PrintManagement
Add-Printer
Add-PrinterDriver
Add-PrinterPort
Get-PrintConfiguration
Get-Printer
Get-PrinterDriver
Get-PrinterPort
Get-PrinterProperty
Get-PrintJob
Read-PrinterNfcTag
Remove-Printer
Remove-PrinterDriver
Remove-PrinterPort
Remove-PrintJob
Rename-Printer
Restart-PrintJob
Resume-PrintJob
Set-PrintConfiguration
Set-Printer
Set-PrinterProperty
Suspend-PrintJob
Write-PrinterNfcTag Get-Service openvpn | Set-Service -StartupType AutomaticIpInterfaceMetric=0$c = [string[]](Get-Content .\0.txt)
$sk1 = [System.Collections.Generic.HashSet[string]]::new($c)
$c = [string[]](Get-Content .\1.txt)
$sk2 = [System.Collections.Generic.HashSet[string]]::new($c)
$sk1.IntersectWith($sk2)
$sk1#классический цикл
foreach ($obj in $list) {
# сделать что-нибудь с переменной $obj
Set-something -name $obj.name -value $obj.value
}
#цикл с использованием pipeline
$list | foreach-object {
# сделать что-нибудь с переменной $_
Set-something -name $_.name -value $_.value
}Set the value of the LocalAccountTokenFilterPolicy registry entry to 1.
For example, the following command uses the New-ItemProperty cmdlet and the Windows PowerShell Registry Provider to create the LocalAccountTokenFilterPolicy registry entry on the local computer and set its value to 1.
new-itemproperty -name LocalAccountTokenFilterPolicy -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -propertyType DWord -value 1
@echo off
@powershell.exe -ExecutionPolicy Bypass -Command "$fn = \"%~f0\"; $_=((Get-Content $fn) -join \"`n\");iex $_.Substring($_.IndexOf(\"goto :\"+\"EOF\")+9)"
@goto :EOF
Start-Process microsoft-edge:https://yoomoney.ru/moneylandia/lootboxes
Start-Sleep 5
Get-Process -Name "*msedge*" | Stop-Process
echo "$fn completed!"
pause