This file contains 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
// can be used at a collection level pre-request script to pull a js from a cdn, and expose the methods to all your requests | |
// can also use a script package instead of a CDN. | |
await (async () => { | |
const requestPromise = new Promise((resolve, reject) => { | |
pm.sendRequest("https://cdn.foo.com/foo_utils.js", (err, res) => { | |
if (err) { | |
console.error(err); | |
return reject(err); | |
} |
This file contains 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
// clear out all the current date vales and then re-add them | |
let vars = JSON.parse(JSON.stringify(pm.globals.values)); | |
vars.forEach((variable) => { | |
let keyName = variable.key; | |
if (keyName.match(/^currentdate|^lorem/i)) { | |
pm.globals.unset(keyName); | |
} | |
}); |
This file contains 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
Clear-Host | |
$parentDir = $PSScriptRoot | |
if ($parentDir) { | |
Write-Host "Cleaning $parentDir" -ForegroundColor Yellow | |
Get-ChildItem -path $parentDir -Filter "bin" -Recurse -Directory | Remove-Item -Recurse -ErrorAction SilentlyContinue -Verbose | |
Get-ChildItem -path $parentDir -Filter "obj" -Recurse -Directory | Remove-Item -Recurse -ErrorAction SilentlyContinue -Verbose | |
} else { |
This file contains 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
Clear-Host | |
$memInfo = Get-WmiObject Win32_PhysicalMemory | |
$diskInfo = Get-Disk | Sort-Object DiskNumber | |
$driveInfo = Get-Volume | Where-Object { $_.DriveLetter } | Sort-Object DriveLetter | |
Write-Host 'Get-ComputerInfo' -ForegroundColor Yellow | |
$computerInfo = Get-ComputerInfo | Select-Object ` | |
@{Name="DNSHostName"; Expression={$_.CsDNSHostName}}, | |
@{Name="Domain"; Expression={$_.CsDomain}}, |
This file contains 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
Clear-Host | |
$hostName = "www.microsoft.com" | |
$req = [System.Net.HttpWebRequest]::Create("https://$hostName") | |
$req.GetResponse().Dispose() | |
[System.Security.Cryptography.X509Certificates.X509Certificate2]$cert = $req.ServicePoint.Certificate | |
#$cert | Format-List * | |
$props = $cert | Select-Object Subject, |
This file contains 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
Clear-Host | |
Write-Host "`r`nSetspn -L `$env:COMPUTERNAME`r`n" -ForegroundColor Yellow | |
Setspn -L $env:COMPUTERNAME | |
Write-Host "`r`nSetspn -L `"`$(`$env:USERDOMAIN)\`$(`$env:USERNAME)`"`r`n" -ForegroundColor Yellow | |
Setspn -L "$($env:USERDOMAIN)\$($env:USERNAME)" | |
Write-Host "`r`nTest-ComputerSecureChannel`r`n" -ForegroundColor Yellow | |
Test-ComputerSecureChannel |
This file contains 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
@rem bat file to ease use of powershell script | |
@%~d0 | |
@cd "%~dp0" | |
powershell.exe -ExecutionPolicy RemoteSigned -NoLogo -NonInteractive -NoProfile -file "%~dpn0.ps1" -Path "%~1" | |
@pause |
This file contains 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
Clear-Host | |
if (!(Get-Module Join-Object)) { | |
Install-Module -Name Join-Object -Force -AllowClobber -Scope CurrentUser | |
} | |
$tcpConnections = Get-NetTCPConnection | |
# list all ports processes: | |
$processes = Get-Process -Id ($tcpConnections).OwningProcess -IncludeUserName |
This file contains 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
Clear-Host | |
if (!(Get-PackageSource -Name Nuget)) { | |
Register-PackageSource -provider NuGet -name Nuget -location "https://www.nuget.org/api/v2" | |
} | |
$remotePackage = Find-Package NuGet.CommandLine -ProviderName Nuget | |
$localPackage = Get-Package NuGet.CommandLine | |
if (!$localPackage -or $remotePackage.Version -gt $localPackage.Version) { |
This file contains 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
utils = { | |
GetUserInfoPromise: function() { | |
return new Promise((resolve, reject) => { | |
// have to use a promise as sendrequest is async if we want to use the response | |
const postman_api_key = pm.globals.get('postman_api_key'); | |
pm.sendRequest({ | |
url: 'https://api.getpostman.com/me', | |
method: 'GET', | |
header: { | |
'X-API-Key': postman_api_key, |
NewerOlder