View change_certificate,ps1
# copy the certificate to "personal" and then execute this command with changed "<FINGERPRINT>"
wmic /namespace:\\root\cimv2\TerminalServices PATH Win32_TSGeneralSetting Set SSLCertificateSHA1Hash="<FINGERPRINT>"
View aws_s3.ps1
<#########################
LINKS
#########################>
<#
resource: https://devops.profitbricks.com/api/s3/
View use_gecko.ps1
# list enumns
# [enum]::getValues([type]"System.Windows.Forms.DockStyle")
# get value of enum entry
# [System.Windows.Forms.DockStyle]::Fill.value__
# enum link https://blogs.technet.microsoft.com/heyscriptingguy/2015/08/27/working-with-enums-in-powershell-5/
cd "C:\FastStats\Build\salesforce\preload\"
View filewatcher.ps1
# show file events like in https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/
$fi = New-Object -Type System.IO.FileSystemWatcher
$fi | gm -type Event | Select Name
View read_odata.ps1
# hints: https://github.com/PowerShell/ODataUtils
# some preparation work for connection to a Redfish endpoint
# enable TLS v1.1 as required by Redfish spec
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocolType]::Tls11
# allow self-signed server certificates
if ([System.Net.ServicePointManager]::CertificatePolicy.GetType().Name -ne 'TrustAllCertsPolicy')
{
Add-Type 'using System.Net;using System.Security.Cryptography.X509Certificates;public class TrustAllCertsPolicy:ICertificatePolicy {public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate,WebRequest request, int certificateProblem) {return true;}}'
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
View read_all_in_once.ps1
# Inspiration: https://www.pipperr.de/dokuwiki/doku.php?id=windows:powershell_oracle_db_abfragen
# https://docs.microsoft.com/de-de/dotnet/framework/data/adonet/retrieving-and-modifying-data
$assemblyFile = "C:\PathToDLL\System.Data.SQLite.dll" # download precompiled binaries for .net or "System.Data.SQLite"
$connString = 'Data Source="file.sqlite";Version=3;'
$sqlCommand = "Select * from households limit 100"
[Reflection.Assembly]::LoadFile($assemblyFile)
View s3_profitbricks.ps1
<#########################
LINKS
#########################>
<#
resource: https://devops.profitbricks.com/api/s3/
https://gist.github.com/chrismdp/6c6b6c825b07f680e710
https://gist.github.com/tabolario/93f24c6feefe353e14bd
View use_other_locale.ps1
# cool function to create a date output in another locale
# SOURCE: https://stackoverflow.com/questions/2379514/powershell-formatting-values-in-another-culture
function Using-Culture ([System.Globalization.CultureInfo]$culture =(throw "USAGE: Using-Culture -Culture culture -Script {scriptblock}"),
[ScriptBlock]$script=(throw "USAGE: Using-Culture -Culture culture -Script {scriptblock}"))
{
$OldCulture = [System.Threading.Thread]::CurrentThread.CurrentCulture
$OldUICulture = [System.Threading.Thread]::CurrentThread.CurrentUICulture
try {
[System.Threading.Thread]::CurrentThread.CurrentCulture = $culture
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture
View phantomdocumentation.js
/*
helper for formatted date and time
*/
function getCurrentDateTime() {
/*
function based on https://stackoverflow.com/questions/25275696/javascript-format-date-time
*/
var today = new Date(Date.now());
View profitbricks_nic_remote_desktop_rpd.ps1
# create empty array for all server network interfaces
$server=@()
# run through every datacenter and append every single server to a list
( profitbricks datacenter list --json | ConvertFrom-JSON ) | ForEach {
# append data from the datacenter
$dataCenterId = $_.Id
$dataCenterName = $_.Name
$dataCenterLocation = $_.Location