Skip to content

Instantly share code, notes, and snippets.

View KirillPashkov's full-sized avatar

Kirill Pashkov KirillPashkov

  • Russia, Moscow
View GitHub Profile
select t1.c1, t2.c1 from t1 left join t2 on t1.c1=t2.c1
union all
select t1.c1, t2.c1 from t1 right join t2 on t1.c1=t2.c1
where t1.c1 is null
order by 1, 2;
$lookup = '***'
Out-File -FilePath C:\temp\results.txt -InputObject $lookup -Encoding utf8 -Force -Append
gci -File 'C:\temp\1' -Recurse -Filter '*.*' -Exclude '*.zip'|
select -exp FullName | % {
$f = gc $_; $l=1
foreach($r in @($f.Split("`n"))){
#if ($r.Length -gt 0 -and $r -match $lookup){Write-Host $("File: {0}`tLine: {1}`tString: {2}" -f $_,$l,$r) -b Black -f Green}; $l++
if ($r.Length -gt 0 -and $r -match $lookup){Out-File -FilePath C:\temp\results.txt -InputObject $("[File: {0}][Line: {1}][String: {2}]" -f $_,$l,$r) -Encoding utf8 -Force -Append }; $l++
}
}
@KirillPashkov
KirillPashkov / Get SQL Procedure Results And Send CSV to SFTP
Created November 12, 2021 15:22
Get SQL Procedure Results And Send CSV to SFTP
# Variable Declaration Region
# WINSCP DLL Location
$WINCSPDLL = 'C:\Temp\Send-ReportToNYSFTP\WinSCPnet.dll'
# SFTP Credentials
$SFTPHostName = '***'
$SFTPHostLogin = '***'
# PPK Data
$PPKLocation = 'C:\Temp\Send-ReportToNYSFTP\Keys\***.ppk'
$PPKPassphrase = '***'
@KirillPashkov
KirillPashkov / Create Windows Scheduled Task For Powershell Script
Created November 12, 2021 15:23
Create Windows Scheduled Task For Powershell Script
schtasks /create /tn Report_Task /tr "powershell -NoLogo -WindowStyle hidden -file Script.ps1" /sc Daily /st 18:00 /ru System