Skip to content

Instantly share code, notes, and snippets.

View gabriel-vanca's full-sized avatar

Gabriel Vanca gabriel-vanca

View GitHub Profile
@gabriel-vanca
gabriel-vanca / Run_Github_script_with_Parameters.ps1
Last active July 19, 2024 03:07
Run Github script with Parameters
$scriptPath = "https://raw.githubusercontent.com/gabriel-vanca/PowerShell_Library/main/Scripts/Windows/Software/close_program.ps1"
$WebClient = New-Object Net.WebClient
$close_program = $WebClient.DownloadString($scriptPath)
$close_program_sb = [Scriptblock]::Create($close_program)
$param1 = "Windows Terminal"
$param2 = "WindowsTerminal"
$param3 = "WindowsTerminal"
Invoke-Command -ScriptBlock $close_program_sb -ArgumentList ($param1, $param2, $param3) -NoNewScope
@gabriel-vanca
gabriel-vanca / Quick_Clone_Github_Repository.ps1
Last active July 19, 2024 03:07
Quick Clone Github repository
$repoDownloadLocalPath = "$env:Temp\WinGet"
#Ensure download folder is empty
if (Test-Path -path $repoDownloadLocalPath) {
Remove-Item $repoDownloadLocalPath -Recurse -Force
}
$repoUrl = "https://github.com/gabriel-vanca/WinGet"
git clone $repoUrl $repoDownloadLocalPath --depth 1 --progress -v
Get-ChildItem $repoDownloadLocalPath -Recurse | Unblock-File
@gabriel-vanca
gabriel-vanca / Refreshing PowerShell Terminal.ps1
Last active July 19, 2024 03:07
Refreshing PowerShell Terminal
# Test Command Existence
function Test-CommandExists {
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] $command
)
$exists = $null -ne (Get-Command $command -ErrorAction SilentlyContinue)
return $exists
}
@gabriel-vanca
gabriel-vanca / Invoke-CommandWithRetries.psm1
Last active July 19, 2024 03:07 — forked from deadlydog/PowerShellUtilities.psm1
Invoke-CommandWithRetries.psm1 - Retries a Powershell command n-times upon failure.
<#
.SYNOPSIS
Retries a Powershell command n-times upon failure.
.DESCRIPTION
The cmdlet is capable of retrying a PowerShell command passed as a [ScriptBlock] according to the user defined number of retries and time between retries.
.PARAMETER ScriptBlock
PoweShell command(s) as a ScriptBlock that will be executed and retried in case of Errors.
Make sure the script block throws an error when it fails, otherwise the cmdlet won't run the retry logic.
@gabriel-vanca
gabriel-vanca / Get-WindowsLicenseInfo.ps1
Last active July 23, 2024 15:21
Windows License Info
<#
.Synopsis
Get the license status of a Windows computer
.DESCRIPTION
Gets the license details via SLMGR.vbs /dlv
.EXAMPLE
Get-WindowsLicenseInfo
Returns the license details of the local computer
@gabriel-vanca
gabriel-vanca / Disable-SSLv3.ps1
Last active July 20, 2024 04:41 — forked from markthiessen/DisableSslv3.ps1
Disable-SSLv3 - PowerShell script for disabling SSLv3 - Refactored
# MS Security bulletin: https://learn.microsoft.com/en-us/security-updates/SecurityAdvisories/2015/3009008
# NOTE: This registry change requires that the system be restarted.
Function Test-RegKeyExists {
param (
$key
)
If (!(Test-Path -Path $key)) {
@gabriel-vanca
gabriel-vanca / Test-Port.ps1
Last active July 25, 2024 16:47
Test-Port
function Test-Port {
<#
.SYNOPSIS
Tests a Port or a range of ports on a specific ComputerName(s).
.DESCRIPTION
Tests a Port or a range of ports on a specific ComputerName(s). Creates a custom object with the properties: ComputerName, Protocol, Port, Open, Notes.
.PARAMETER ComputerName
A single ComputerName or array of ComputerName to test the port connection on. Aliased to 'CN', 'Server'
.PARAMETER Port
Port number to test ([int16] 0 - 65535), an array can also be passed
@gabriel-vanca
gabriel-vanca / Get-SysInfo.ps1
Last active August 28, 2024 01:55
Get-SysInfo
Function Get-SysInfo {
<#
.SYNOPSIS
Gether system inforamtion
.DESCRIPTION
Gather information such as the Computer Name, OS, Memory Information, Disk Information and CPU Information on a local or remote system.
.PARAMETER Computer
The local or remote system to gather information from
#>
[CmdletBinding()]
@gabriel-vanca
gabriel-vanca / Get-DotNet.ps1
Last active August 2, 2024 01:09
Manage DotNet
function Get-InstalledDotNet {
<#
.SYNOPSIS
Display version of .net installed on a system
.DESCRIPTION
Query the registry on a local or remote system to display the version of .net installed
.PARAMETER ComputerName
The name of the computer to run the query on
#>
@gabriel-vanca
gabriel-vanca / Get-SystemSoftware.ps1
Last active July 23, 2024 06:30
Get-SystemSoftware
Function Get-SystemSoftware{
<#
.SYNOPSIS
Gather software installed on a local or remote device
.DESCRIPTION
Gather Software and information about the software installed on a local or remote device using the registry or WMI
.PARAMETER ComputerName
Computer to gather software on
.PARAMETER QueryType
Specify how you want to gather the information