SHIFT-WIKI - Sjoerd Hooft's InFormation Technology
This WIKI is my personal documentation blog. Please enjoy it and feel free to reach out through blue sky if you have a question, remark, improvement or observation. See below for the latest additions, or use the search or tags to browse for content.
Bash: Environment Script For Production and Acceptance
Summary: A small script to warn users about in which environment they have logged on to.
Date: 22 March 2011
Refactor: 6 April 2025: Checked links and formatting.
This is a script I use to warn users for the environment they work on. We have a lot of different environments and I like to take every opportunity to warn them about the environment, especially production. This is based on the hostname. I also use it to show a few specific thing, for example, where their system mails gets forwarded to. Below the script you'll find a section on how to set the script into action.
#!/bin/bash
########################################################################################################################
# Author : Sjoerd Hooft
# Date Initial Version: 22 March 2011
# Comments: sjoerd_getshifting.com
#
# Description:
# This is the script to warn about the environment where users login to.
#
# Recommendations:
# The script is designed for a 120 column terminal.
#
# Changes:
# Please comment on your changes to the script (your name and email address, line number, description):
########################################################################################################################
# Script Variables
BOLD=`tput bold`
BOLDOFF=`tput sgr0`
ENV=`hostname -s | awk -F- '{ print $2 }'`
MAIL=`cat $HOME/.forward`
if [ $ENV == prd ]; then
echo
echo "You have logged on to the ${BOLD}PRODUCTION ENVIRONMENT${BOLDOFF}. Be careful."
echo "You have logged on to the ${BOLD}PRODUCTION ENVIRONMENT${BOLDOFF}. Be very careful."
echo
echo "Your local mail is being forwarded to $MAIL"
echo "If this is wrong please change it in $HOME/.forward"
else
echo "You have logged on to the Acceptance environment"
fi
exit
Script: Azure DevOps API: Remove Leases
Summary: Goal of the script is to remove all the leases that are set on all of the builds that are created with a specific pipeline.
Date: Around 2022
Refactor: 6 April 2025: Checked links and formatting.
Goal of the script is to remove all the leases that are set on all of the builds that are created with a specific pipeline:
- Retrieve the builddefinition id for the specified pipeline
- Lists all leases for the builddefinition
- Removes all the leases for the build definition id
If the leases kept you from deleting the build pipeline, you can delete the pipeline afterwards.
Powershell: Azure DevOps API: Keep Forever
Summary: Goal of the script is to check all my deployments in production and set the retain indefinitely / keep forever property to true if this is not done yet.
Date: Around 2022
Refactor: 6 April 2025: Checked links and formatting.
The script below uses the following parts / useful techniques:
- List all projects
- List all deployments
- Get Releases
- The combined use of the $top parameter and a continuation token
SCCM Custom Report Subscriptions
Summary: How to configure custom reports on SCCM 2012.
Date: Around 2014
Refactor: 6 APril 2025: Checked links and formatting.
Environment:
- SCCM 2012 (Version 1810) on Windows Server 2012 R2 (Version 6.3 Build 9600)
- MS SQL 2012 SP4 on Windows Server 2012 R2 (Version 6.3 Build 9600)
Goal: Create a SCCM Custom Report subscription with custom dates. One of the whole previous month and one of yesterday and today.
