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
$files = @( | |
"C:\Program Files\PowerShell\7\profile.ps1" | |
"C:\Program Files\PowerShell\7\Microsoft.PowerShell_profile.ps1" | |
"C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1" | |
"C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShellISE_profile.ps1" | |
"C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1" | |
"$($env:onedrive)\PowerShell\Microsoft.PowerShell_profile.ps1" | |
"$($env:onedrive)\PowerShell\profile.ps1" |
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
$excludeFilter = @( | |
'Confirm' | |
'Debug' | |
'ErrorAction' | |
'ErrorVariable' | |
'InformationAction' | |
'InformationVariable' | |
'OutBuffer' | |
'OutVariable' | |
'PipelineVariable' |
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
$repo = "F5Networks/f5-appsvcs-extension" | |
$filenamePattern = "*.noarch.rpm" | |
$releasesUri = "https://api.github.com/repos/$repo/releases/latest" | |
$downloadUri = ((Invoke-RestMethod -Method GET -Uri $releasesUri).assets | Where-Object name -like $filenamePattern ).browser_download_url | |
$filePath = Join-Path -Path $([System.IO.Path]::GetTempPath()) -ChildPath $(Split-Path -Path $downloadUri -Leaf) | |
Invoke-WebRequest -Uri $downloadUri -Out $filePath |
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
#Requires -RunAsAdministrator | |
$modules = Get-Module -Name Pester -ListAvailable | |
if ($null -ne $modules) { | |
$pesterPaths = (get-item $modules.modulebase).parent.Fullname | Sort-Object -Unique | |
foreach ($pesterPath in $pesterPaths) { | |
takeown /F $pesterPath /A /R |
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 New-MyRemoteSession { | |
<# | |
.SYNOPSIS | |
Setup a PowerShell profile on a remote computer | |
.DESCRIPTION | |
By default this function will copy the local 'profile.ps1' file from $PSHOME to same location on the remote computer you choose | |
.EXAMPLE | |
PS C:\> New-MyRemoteSession -ComputerName "server01.local" | |
Copies profile.ps1 from local $PSHOME folder path to remote $PSHOME folder path and sets the profilename to 'WithProfile' |
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
## CHROME | |
$Path = "$env:USERPROFILE\AppData\Local\Google\Chrome\User Data\Default\Login Data" | |
#If Path doesnt exist > Stop | |
if(![system.io.file]::Exists($Path)){Break} | |
Else{ | |
Add-Type -AssemblyName System.Security | |
# Credit to Matt Graber for his technique on using regular expressions to search for binary data | |
$Stream = New-Object IO.FileStream -ArgumentList "$Path", 'Open', 'Read', 'ReadWrite' | |
$Encoding = [system.Text.Encoding]::GetEncoding(28591) | |
$StreamReader = New-Object IO.StreamReader -ArgumentList $Stream, $Encoding |
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
<# | |
.Synopsis | |
Read Password Vault | |
.DESCRIPTION | |
Get Windows Password Vault for Logged on user | |
.EXAMPLE | |
Get-WinPassword | |
#> | |
#function Get-PasswordVault { | |
[void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime] |
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
#Ref: https://www.thomasmaurer.ch/2019/07/how-to-install-and-update-powershell-7/ | |
Windows: | |
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Preview" | |
Linux: | |
wget https://aka.ms/install-powershell.sh; sudo bash install-powershell.sh -preview; rm install-powershell.sh |
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
Snippets CTL+ALT+J | |
Auto-Format CTL+ALT+F | |
Command Palette CTL+SHIFT+P | |
Expand Aliases CTL+ALT+E |
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
cls | |
Clear-DnsClientCache | |
$NameServers = @( | |
"8.8.8.8", | |
"8.8.4.4", | |
"208.67.222.222", | |
"1.1.1.1" | |
) |
NewerOlder