function Escape-JSONString($str){ | |
if ($str -eq $null) {return ""} | |
$str = $str.ToString().Replace('"','\"').Replace('\','\\').Replace("`n",'\n').Replace("`r",'\r').Replace("`t",'\t') | |
return $str; | |
} | |
function ConvertTo-JSON($maxDepth = 4,$forceArray = $false) { | |
begin { | |
$data = @() | |
} |
# ================================================================================ | |
# ObjectStorageUploader.py | |
# © Copyright IBM Corporation 2014. | |
# LICENSE: MIT (http://opensource.org/licenses/MIT) | |
# ================================================================================ | |
import argparse | |
import os | |
import math | |
import http.client |
<# | |
This script performs the 'search' phase of a Windows Update, using the standard WUA API. | |
It does not download or install updates. | |
Sole purpose of this script is to find out how long it takes to download the required cabfile, | |
then process it against a live system and return the list of updates available for that system. | |
#> | |
function DownloadFile { | |
param ( | |
[Parameter(Mandatory=$true,Position=0)] $url, | |
[Parameter(Mandatory=$true,Position=1)] $file |
#!/bin/bash | |
# This file must be executable to work! chmod 755! | |
# | |
# The LUKS key must exist as a file at /etc/.keys/${device}.key | |
# Protect this directory: root as user/group, 400 as permissions | |
# | |
# Edit your autofs master file to include something like | |
# /mnt/crypt /etc/auto.luks --timeout=600 | |
# | |
# Then you can access your LUKS encrypted disk with |
rem windows2012R2スクリプト | |
rem icmp(ping)を通す設定(”profile=public|private|domain|any”で個別指定可能) | |
netsh advfirewall firewall add rule name="ICMPv4 ping許可" protocol=icmpv4:8,any dir=in action=allow | |
rem メモ帳のショートカットをデスクトップに作成【done】 | |
powershell -Command "&{$WsShell = New-Object -ComObject WScript.Shell; $Shortcut = $WsShell.CreateShortcut('C:\Users\Administrator\Desktop\memo.lnk'); $Shortcut.TargetPath = 'C:\Windows\System32\notepad.exe'; $Shortcut.IconLocation = 'C:\Windows\System32\notepad.exe'; $Shortcut.Save()} | |
rem コマンドプロンプトのショートカットをデスクトップに作成【done】 | |
powershell -Command "&{$WsShell = New-Object -ComObject WScript.Shell; $Shortcut = $WsShell.CreateShortcut('C:\Users\Administrator\Desktop\cmd.lnk'); $Shortcut.TargetPath = 'C:\Windows\System32\cmd.exe'; $Shortcut.IconLocation = 'C:\Windows\System32\cmd.exe'; $Shortcut.Save()} |
$token = '<API_Token>' | |
$headers = @{ | |
"Authorization" = "Bearer $token" | |
"Content-type" = "application/json" | |
} | |
$body = @{ | |
accountName="<Your_account>" | |
projectSlug="<Your_project_slug>" |
function Search-FileIndex { | |
<# | |
.PARAMETER Path | |
Absoloute or relative path. Has to be in the Search Index for results to be presented. | |
.PARAMETER Pattern | |
File name or pattern to search for. Defaults to *.*. Aliased to Filter to ergonomically match Get-ChildItem. | |
.PARAMETER Text | |
Free text to search for in the files defined by the pattern. | |
.PARAMETER Recurse | |
Add the parameter to perform a recursive search. Default is false. |
When you're decomissioning a machine that has been managed by Puppet you may want to programatically clean up the node. There are two parts to this:
- revoking and deleting the certificate of the node in Puppet's CA
- deactivating the node in PuppetDB
The following should work for Puppet 4.x and Puppet DB 4.x (including Puppet Enterprise 2016.4.x, 2017.1.x, 2017.2.x).
I've used certificate based auth, and the examples are being run from the puppet master so make use of existing certificates for authentication. When run remotely the cacert, certificate and corresponding private key for authentication will need to be present.
This script was donated by a customer of ours. They have sent us a sanitized version of the script to share.
Please use this at your own risk, and fully understand what it is doing before using it!
SCCM Installation fires off in the background and you have no idea whether it worked or not. Also, if any other installs try to start while the SCCM setup is running, you will get an error.