我想拉开拉链
Get-ChildItem -Path E:\test | Where-Object {$_.PSIsContainer} | Sort-Object LastWriteTime -Descending | Select-Object -First 1
我试过这个
$command ='Get-ChildItem -Path E:\test | Where-Object {$_.PSIsContainer} | Sort-Object LastWriteTime -Descending | Select-Object -First 1';
$file= iex $command
并将 $file 放入 zip 函数中但导致错误。
Get-ChildItem : Access to the path 'C:\Windows\System32\Com\dmp' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\Com\dmp:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\config' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\config:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\Configuration' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\Configuration:String) [Get-ChildItem], UnauthorizedAccessExcept
ion
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\ias' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\ias:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\inetsrv\config' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\inetsrv\config:String) [Get-ChildItem], UnauthorizedAccessExcep
tion
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\LogFiles\Fax\Incoming' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\Syst...es\Fax\Incoming:String) [Get-ChildItem], UnauthorizedAccessExcept
ion
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\LogFiles\Fax\Outgoing' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\Syst...es\Fax\Outgoing:String) [Get-ChildItem], UnauthorizedAccessExcept
ion
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\LogFiles\Firewall' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\LogFiles\Firewall:String) [Get-ChildItem], UnauthorizedAccessEx
ception
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\LogFiles\HTTPERR' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\LogFiles\HTTPERR:String) [Get-ChildItem], UnauthorizedAccessExc
eption
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\LogFiles\WMI' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\LogFiles\WMI:String) [Get-ChildItem], UnauthorizedAccessExcepti
on
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\MsDtc' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\MsDtc:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\networklist' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\networklist:String) [Get-ChildItem], UnauthorizedAccessExceptio
n
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\spool\PRINTERS' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\spool\PRINTERS:String) [Get-ChildItem], UnauthorizedAccessExcep
tion
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\spool\SERVERS' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\spool\SERVERS:String) [Get-ChildItem], UnauthorizedAccessExcept
ion
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\sru' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\sru:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\Tasks' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\Tasks:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\wbem\MOF' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\wbem\MOF:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\wdi' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\wdi:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
Get-ChildItem : Access to the path 'C:\Windows\System32\wfp' is denied.
At E:\scripts\last modified folder.ps1:15 char:8
+ $bak = Get-ChildItem -Recurse -Path $filePath #| Where-Object { $_.Extension -eq ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\System32\wfp:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand