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 | |
# UPDATE QUERY / SERVER / DB | |
$serverInstance = "..." | |
$database = "..." | |
$query = " | |
SELECT * FROM sys.tables | |
" | |
# UPDATE QUERY / SERVER / DB |
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
DECLARE @procedure_name sysname = 'dbo.procedure_name' | |
SELECT | |
OBJECT_SCHEMA_NAME([p].[object_id]) AS [schema], | |
OBJECT_NAME([p].[object_id]) AS [procedure_name], | |
[p].[name] AS [parameter_name], | |
CONCAT('sqlParams.Add("', [p].[name] ,'", ', [p].[name], ', ', [fn].db_type, ');') | |
FROM sys.[parameters] AS [p] | |
INNER JOIN sys.[types] AS [t] | |
ON [p].[system_type_id] = [t].[system_type_id] | |
AND [p].[user_type_id] = [t].[user_type_id] |
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
-- Examples of the various ways to alias columns. All other methods except for #1 are deprectated or older styles | |
SELECT | |
1 AS [one], | |
2 [two], | |
3 AS 'three', | |
4 'four', | |
5 AS "five", | |
6 "six", | |
[seven] = 7, |
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 |
NewerOlder