Skip to content

Instantly share code, notes, and snippets.

View v2kiran's full-sized avatar

Kiran Reddy v2kiran

View GitHub Profile
@v2kiran
v2kiran / always-running-scheduled-task.ps1
Created September 10, 2025 18:26 — forked from gregjhogan/always-running-scheduled-task.ps1
Windows scheduled task that stays running forever and restarts if it dies
$folder = "C:\folder"
$cmd = "powershell.exe "
$args = "-NoLogo -NonInteractive -WindowStyle Maximized -File script.ps1"
$user = "username-to-run-as"
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).Date -RepetitionInterval (New-TimeSpan -Minutes 1)
$action = New-ScheduledTaskAction -WorkingDirectory $folder -Execute $cmd -Argument $args
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -MultipleInstances IgnoreNew -RestartInterval (New-TimeSpan -Minutes 1) -RestartCount 999 -ExecutionTimeLimit (New-TimeSpan -Seconds 0)
$principal = New-ScheduledTaskPrincipal -UserId $user -LogonType Interactive
$task = New-ScheduledTask -Principal $principal -Action $action -Settings $settings -Trigger $trigger
@v2kiran
v2kiran / winrm-https-self-signed-cert.ps1
Created August 22, 2025 18:31 — forked from gregjhogan/winrm-https-self-signed-cert.ps1
Configure WinRM HTTPS w/ self-signed certificate
# configure
$cert = New-SelfSignedCertificate -CertstoreLocation Cert:\LocalMachine\My -DnsName $env:COMPUTERNAME
Enable-PSRemoting -SkipNetworkProfileCheck -Force
New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $cert.Thumbprint –Force
New-NetFirewallRule -DisplayName "Windows Remote Management (HTTPS-In)" -Name "Windows Remote Management (HTTPS-In)" -Profile Any -LocalPort 5986 -Protocol TCP
# connect
Enter-PSSession -ComputerName {X.X.X.X} -Credential (Get-Credential) -SessionOption (New-PsSessionOption -SkipCACheck -SkipCNCheck) -UseSSL
# Test Report: Pester Results on Windows using Windows PowerShell 5.1
* Date: 2022-02-12
* Time: 15:33:54
Expand the following summaries for more details:
<details>
<summary> Environment:
@v2kiran
v2kiran / InstalledSoftware2.ps1
Created December 22, 2020 15:36
Get Installed software
# Registry locations for installed software
$paths =
# all users x64
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
# all users x86
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*',
# current user x64
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
# current user x86
'HKCU:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
@v2kiran
v2kiran / gist:09c7043a7523c720fc35f387b6ee8dc7
Created December 18, 2020 15:11
Find installed software
# list of registry locations where installed software is stored
$paths =
# all users x64
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
# all users x86
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*',
# current user x64
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
# current user x86
# Test Report: Pester Results on Windows using Windows PowerShell 5.1
* Date: 2020-11-20
* Time: 09:16:07
Expand the following summaries for more details:
<details>
<summary> Environment:
@v2kiran
v2kiran / Windows
Last active February 12, 2022 15:34
# Test Report: Pester Results on Windows
* Date: 2022-02-12
* Time: 15:34:05
Expand the following summaries for more details:
<details>
<summary> Environment:
@v2kiran
v2kiran / macOS
Last active February 12, 2022 15:34
# Test Report: Pester Results on macOS
* Date: 2022-02-12
* Time: 15:33:51
Expand the following summaries for more details:
<details>
<summary> Environment:
@v2kiran
v2kiran / Linux
Last active February 12, 2022 15:33
# Test Report: Pester Results on Linux
* Date: 2022-02-12
* Time: 15:33:43
Expand the following summaries for more details:
<details>
<summary> Environment:
@v2kiran
v2kiran / testreport
Last active November 19, 2020 12:49
# Test Report: PSLiteDB Tests
* Date: 2020-11-19
* Time: 12:47:50
Expand the following summaries for more details:
<details>
<summary> Environment: