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) |
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
# 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
psexec -accepteula -i -d -s mmc taskschd.msc |
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
["server-1", "server-2", "server-3"].each { server -> | |
task "deploy-to-$server" (type: Copy) { | |
description: "Copies the project executables to $server" | |
enabled: true | |
group: "distribution" | |
afterEvaluate { Project project -> | |
from: "$distDir/$distZip" | |
into: "\\\\$server\\share\\${project.name}\\" | |
} | |
} |
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
'''''''''''''''''''''''''''''''''''''''''''''''''' | |
'' A sub process to perform the conversion. | |
'' Takes no parameters. | |
'' Has no return value. | |
'' Call it for instance on Workbook_Open(). | |
'''''''''''''''''''''''''''''''''''''''''''''''''' | |
Sub ImageLinksToImages() | |
Dim new_picture_shape As Shape | |
Dim picture_file_name As String | |
Dim picture_width As Long |
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
Function Get-FolderSize { | |
BEGIN { $fso = New-Object -ComObject Scripting.FileSystemObject } | |
PROCESS { | |
$path = $input.fullname | |
$folder = $fso.GetFolder($path) |
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
$who = New-Object System.Management.Automation.PSCredential( | |
"[email protected]", | |
(ConvertTo-SecureString "TheSecret" -AsPlainText -Force) | |
) -ErrorAction Stop; | |
#NOTE: this version of Send-MailMessage does NOT have a -ReplyTo parameter. | |
Send-MailMessage ` | |
-From [email protected] ` | |
-Subject $("{0} Reports, dd. {1}" -f $files_count, $now) ` | |
-To undisclosed recipients ` | |
-Body $([System.String]::Concat( |
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
mstsc -v:server.domain.edu /admin /F -console |
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
<# Analyze normal run duration of scheduled tasks. | |
# Gathers insight into how long tasks run, analyzes | |
# which tasks run shorter or longer than normal, | |
# reports back to console, and writes out its report | |
# as a CSV (spreadsheet). | |
# | |
# The script assumes that the user account running it | |
# has access to the computer and is allowed to read | |
# its event log. | |
# |
NewerOlder