This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get all log files older than 1 day in the logs folder. | |
$subjects = Get-ChildItem -Path "D:\logs" -Filter "*.log" -file | Where-Object {$_.LastWriteTime -le ((get-date).AddDays(-1))} | |
# Compress them into a zip file, overwriting ones with the same name. | |
$subjects | Compress-Archive -DestinationPath "A:\archives\logs.zip" -Force | |
# Remove the originals. Note that if compressing fails, items will not get removed. | |
$subjects | Remove-Item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# Assuming your computing device is online and can get through the firewall, | |
it is possible (because that was the problem in my case), that Powershell | |
chose an internet security cipher that is outdated or not available. | |
Errors typically include: | |
WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''. | |
WARNING: Unable to download the list of available providers. Check your internet connection. | |
Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. | |
The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified | |
package has the tags. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @local_target_path varchar(50) = 'c:\must\be\local\path' | |
, @adodb_file_stream int | |
, @create_instance_error int | |
, @error int | |
, @i bigint | |
, @data varbinary(max) | |
, @error_count int | |
, @error_description varchar(255) | |
, @error_source varchar(255) | |
, @file_path varchar(max) |
OlderNewer