Skip to content

Instantly share code, notes, and snippets.

@TiloGit
TiloGit / ps-direct-task.ps1
Created May 3, 2024 17:24
win task scheduler powershell direct command (no script)
##some examples how to run PS direct command in win task scheduler
##run in admin shell
##simple style
$Trigger = New-ScheduledTaskTrigger -Daily -At "10:15pm" # Specify the trigger settings
$User = "NT AUTHORITY\SYSTEM" # Specify the account to run the script
$Action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument '-Command Get-ChildItem C:\myapp\config\tmp -Recurse | Where LastWriteTime -lt (Get-Date).AddDays(-2) | Remove-Item -Recurse -Force 2>&1 > C:\myapp\logs\ps-script-out.log' # Specify what program to run and with its parameters
@TiloGit
TiloGit / yq-example.sh
Created April 23, 2024 16:51
YQ examples
###just soem YQ examples
##working
yq e '.spec.template.spec.containers[]' keycloak.yaml
###
yq e '.spec.template.spec.containers[].env[] | select(.name == "KEYCLOAK_ADMIN_PASSWORD") | .value' keycloak.yaml
##update
yq -r '(.spec.template.spec.containers[].env[] | select(.name == "KEYCLOAK_ADMIN_PASSWORD") | .value) = "myNewPass"' keycloak.yaml
wget -q -O - https://raw.githubusercontent.com/keycloak/keycloak-quickstarts/latest/kubernetes/keycloak.yaml | \
yq '(.spec.template.spec.containers[].env[] | select(.name == "KEYCLOAK_ADMIN_PASSWORD") | .value) = "myNewPass"' - | \
@TiloGit
TiloGit / fn-acce-icc4sap-ilm-props.js
Created March 14, 2024 19:29
FileNet ACCE batch Action to create SAP properties (ICC4SAP) for SAP ILM (SAP BC-ILM)
//paste in ACCE bulk operation (select only one item)
//works on older CPE 5.5.5 (tested on cpe version ears-5.5.5-2-146)
// FN CPE Used: Mozilla Rhino scripting engine check what version in Engine-liberty.ear APP-INF/lib/js.jar
importClass(java.lang.System);
function OnCustomProcess(CEObject) {
var objStore = CEObject.getObjectStore();
objStore.refresh();
@TiloGit
TiloGit / fn-acce-icc4sap-props.js
Last active March 14, 2024 19:30
FileNet ACCE batch Action to create SAP properties (ICC4SAP)
//paste in ACCE bulk operation (select only one item)
//works on CPE 5.5.8 or newer (due to for loop);
//see comments below for loop with older version
importClass(java.lang.System);
function OnCustomProcess(CEObject) {
var objStore = CEObject.getObjectStore();
objStore.refresh();
var sapprops = [
@TiloGit
TiloGit / mini-web.ps1
Created January 3, 2024 20:41
powershell mini webserver (to serve txt tile for HTTP validation for example)
$basePath='C:\mini-webserver\'
mkdir -p "$basePath/web/.well-known/pki-validation/"
##paste the txt file to this location
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
##port 80 requires admin PS
$http.Prefixes.Add("http://+:80/")
# Start the Http Server
$http.Start()
@TiloGit
TiloGit / README
Created April 17, 2020 18:34 — forked from xbb/README
IDRAC6 Virtual Console Launcher
Use this as an example on how to start the virtual console without the need of Java Web Start or accessing it from the web interface.
You can use the user and password that you use for the web interface.
You need an old JRE... I used 1.7.0_80 from the Server JRE package, also I have tested successfully 1.7.0_79 with MacOS.
You don't need to install it, just extract it or copy the files in "jre" folder.
Open the viewer.jnlp file that you get by launching the virtual console from the web interface with a text editor.
Note the urls to the jar files. Download the main jar file avctKVM.jar and the libs for your operating system and architecture.
Extract the dlls (.so Linux, .jnilib MacOS) from the jar libs.
##based on https://github.com/12Knocksinna/Office365itpros/blob/master/ReportPermissionsApps.PS1
#
# ReportPermissionsApps.PS1
# A script using Azure Automation and a managed identity to scan for apps assigned high-priority permissions and report them
# for administrator review
##install graph PS
Install-Module Microsoft.Graph -Scope CurrentUser
#Connect-AzAccount -Identity
@TiloGit
TiloGit / Get_AzureApp.ps1
Last active February 9, 2023 16:12
Check Azure AD enterprise apps
Get-AzureADServicePrincipal -All:$true | ? {$_.Tags -eq "WindowsAzureActiveDirectoryIntegratedApp"} | Foreach-Object{
$AppObjectId = $_
$AppUser = Get-AzureADServiceAppRoleAssignment -ObjectId $AppObjectId.ObjectId #-All $true
New-Object -TypeName PSObject -Property @{
AppDisplayName = $AppObjectId.DisplayName
AppDisplayName2 = $AppObjectId.AppDisplayName
AppPublisherName = $AppObjectId.PublisherName
AppObjectId = $AppObjectId.ObjectId
@TiloGit
TiloGit / petool.sh
Last active December 23, 2022 19:54
FN PE tools vwlog vwtool pelog in container
#PE Tools on container
# 1. Downlaod IBM FileNet Process Engine >> PE Java API from ACCE
# 2. also CE for jace.jar
#create jre or jdk pod
kind: Pod
apiVersion: v1
metadata:
name: tilo-jdk-pod
@TiloGit
TiloGit / shaw-compress.sh
Created December 3, 2022 00:19
compress and rename shaw PDFs
##for PDF invoices with filename like ShawInvoice_01412345678_01Apr2022.pdf
for file in Shaw*.pdf
do
echo "$(date +"%F_%s") Start $file"
filedate=$(basename "$file" .pdf | tail -c 10)
outFdate=$(date -d $filedate +"%F")
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/ebook -sOutputFile=${outFdate}_${file} $file
echo "$(date +"%F_%s") Done $file"
done