Windows Powershell

Удалённое Подключение PowerShell - <https://techtalk.gfi.com/how-to-manage-your-servers-remotely-with-powershell/>

Enter-PSSession –ComputerName host [-Credential username]
Enter-PSSession -ComputerName main-1700 -Credential domain\user
# список файлов - list files powershell
 $filter= "avi"
 $source="K:\Остеопатия\массаж"
 $destination ="D:\Films\massage"
 set-location $source
 
 $source_regex = [regex]::escape($source)
 (Get-ChildItem $source -recurse | where {-not ($_.psiscontainer)} | select -expand fullname)  -match $filter |
         foreach { 
          $file_name = ($_ | split-path -leaf)
          $file_name_withoutextension =  [System.IO.Path]::GetFileNameWithoutExtension($file_name)
          $file_destination = $destination + '\' + $file_name_withoutextension
          $file_dest = ($_ | split-path -parent) -replace $source_regex,$file_destination
 
          #if (-not (test-path $file_dest)){mkdir $file_dest}
           #copy-item $_ -Destination $file_dest
            #Write-Output -InputObject
             $_
             #($_.Split("\"))
             #| Select-Object -Property Length
        }
# put files in list
Get-ChildItem -Recurse -Include *.pdf| Format-Table name -hidetableheaders | Out-File 'pdf list.txt'