A List of PowerShell Books

1593279183PowerShell for Sysadmins: Workflow Automation Made Easy by No Starch Press
1617294160Learn Windows PowerShell in a Month of Lunches by Manning Publications
1449320686Windows PowerShell Cookbook: The Complete Guide to Scripting Microsoft's Command Shell by O'Reilly Media
1789536669Mastering Windows PowerShell Scripting: Automate and manage your environment using PowerShell Core 6.0, 3rd Edition by Packt Publishing
B085RQNL9XWindows PowerShell and Scripting for Beginners: Complete Beginners Guide to learn Windows PowerShell and its Scripting by Independently published
1617295094Learn PowerShell Scripting in a Month of Lunches by Manning Publications
0735675112Windows PowerShell Step by Step by Microsoft Press
1789808537Windows Server 2019 Automation with PowerShell Cookbook: Powerful ways to automate and manage Windows administrative tasks, 3rd Edition by Packt Publishing
1449320961Windows PowerShell Pocket Reference: Portable Help for PowerShell Scripters (Pocket Reference (O'Reilly)) by O'Reilly Media
1119560713Windows Server 2019 & PowerShell All-in-One For Dummies (For Dummies (Computer/Tech)) by For Dummies
1633430294Windows PowerShell in Action by Manning Publications
B085XGXCD5Powershell: The Ultimate Guide to Learning and Understanding Powershell Programming
B085KBSVTFPowerShell for Beginners: The Complete Guide to Master Windows PowerShell Scripting by Independently published
B0731CVMTHPowerShell for Office 365: Automate Office 365 administrative tasks by Packt Publishing
1761032704Powershell: The ultimate beginner's guide to Powershell, making you a master at Windows Powershell command line fast! by Ingram Publishing
B08GGBZP13PowerShell: The Ultimate Beginners Guide to Learn PowerShell Step-by-Step by Publishing Factory
B07YSWM2VDPowerShell: The Complete Beginners Guide for Windows PowerShell.: A Step by Step Guide for PowerShell Scripting! by SJ Publishing
1484263871Building Better PowerShell Code: Applying Proven Practices One Tip at a Time by Apress
1484245032PowerShell and Python Together: Targeting Digital Investigations by Apress

How Do You Test the “mount -a” Command to Verify Sufficient Permissions on a Linux VM?

Problem scenario
You want to test "mount -a" to verify your user has sufficient permissions. You cannot add a physical device to the Linux server. How do you confirm "mount" will work?

Solution
Create a directory to be a mount point:
sudo mkdir /aaa
Find a block device to mount. One way would be to run this: sudo cat /proc/partitions
Once found, run this: sudo mount /dev/dm-2 /aaa

Run this command: sudo mount -l | grep aaa
Then the ouput will be something like this: /dev/mapper/foobar on /aaa type ext4 (rw, …)
Copy the /dev/mapper/foobar /aaa ext4 entries (all three). Back up the /etc/fstab file to /etc/fstab.bak
Update the /etc/fstab to have the three entries recently identified as the last line. For example, the last line will look something like this:
/dev/mapper/foobar /aaa ext4

Unmount the newly mapped partition by using a command like this: sudo umount /dev/dem-2
Now run sudo mount -a
Run this command: sudo mount -l | grep aaa

How Do You Install Erlang on a Debian/Ubuntu Server?

Problem scenario
You want to install Erlang on a Debian or Ubuntu Server (e.g., Linux Mint or Kali Linux). What should you do?

Solution
Run this script with sudo (e.g., sudo bash /tmp/erlang.sh):

# Written by www.continualintegration.com
#/bin/bash

echo "This script can take 20 minutes to run"
apt -y update
apt -y install autoconf 
apt -y install libncurses5-dev 
apt -y install libncursesw5-dev
apt -y install gcc
apt -y install python3
apt -y install make
cd /bin/
git clone https://github.com/erlang/otp.git
cd otp
./otp_build autoconf
./configure
echo "This next portion may take 15 minutes"
date > /tmp/datetime.txt
make
make install
ln -s /usr/local/lib/erlang/bin/erl /usr/bin/erl
ln -s /usr/local/bin/erlc /usr/bin/erlc
ln -s /etc/alternatives/python3 /usr/bin/python
echo "Script run completed."
echo " "
echo "Many errors above (if there are any) may be ignorable"
echo "try the 'erl' command with no quotes to see if Erlang was installed"
echo 'If you get to a carrot prompt, use Ctrl-c, then type the "a" key and then press Enter.'

How Do You Create an EC-2 Instance Running RHEL 8.x in the AWS Web UI?

Problem scenario
You want to use the AWS Management Console to create a server. What do you do?

Solution
Prerequisite

This assumes you have already configured a .ppk file, and you know its password. If you need assistance, see this posting.

Procedures

  1. Log into the AWS management console (aws.amazon.com).
  2. Go to the EC2 Dashboard.
  3. Click "Launch instances"
  4. Find "Red Hat Enterprise Linux 8…" and choose "Select"
  5. Choose the various options, and then click "Next…". Often the default settings work -- except for the "Configure Security Group" setting. Find the appropriate Security Group and click "Review and Launch".
  6. Click "Launch". To the pop up, choose "Select a key pair" associated with the .pem file that created the .ppk file for which you know the password.
  7. Click "I acknowledge that I have access…", and click "Launch instances".

How Do You Troubleshoot “yum-config-manager command not found”?

Problem scenario
You run a "yum-config-manager" on a Linux server, but you get an error about the command not being found. What should you do?

Possible solution
Run this: sudo yum -y install yum-utils

This should install it. If it doesn't, you may not have a "yum" distribution of Linux. You may be using SUSE, Debian or Ubuntu Linux. Run this command to find out what family of Linux you need: cat /etc/*-release

How Do You Install StackStorm?

Problem scenario
You want to try this automation tool called Stack Storm. How do you install it on Linux?

Solution
Prerequisites

  • We recommend a server with four CPUs. The load on a server with one CPU can be above 20 when trying to install it -- if it is possible to install it correctly on a server with one CPU.
  • Your Linux server must be either a Debian (e.g., Ubuntu, Kali Linux, Linux Mint) derivative or a Red Hat (e.g., RHEL, Fedora or CentOS) derivative. SUSE will not work with this solution below.
  • You must also have access to the internet from your Linux server.
  • You have a server that has not had StackStorm installed on it, and the installation of StackStorm has not been attempted on the server either.

Procedures
Run this command (but change "contintuser" to the username of your choice and change "Gre@tP@$$w0rd" to the password of your choice):

curl -sSL https://stackstorm.com/packages/install.sh | bash -s -- --user=contintuser --password='Gre@tP@$$w0rd'

How Do You Securely Connect an EC-2 Instance in a VPC to a DynamoDB?

Problem scenario
You have a server in AWS that is in a VPC. You want it to access an S3 bucket. How do you do this?

Solution
Use a VPC endpoint, specifically, use a Gateway Endpoint.

Source: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints.html

How Do You Get conjure-up To Provide an Option for AWS, Azure or GCP when Deploying Kubernetes?

Problem scenario
You run "conjure-up kubernetes", but on the page "Where would you like to deploy?" you do not see an option for AWS, Azure, or GCP (Google Cloud Platform).

You see options for maas, openstack, and vsphere. But the public cloud options are missing. What should you do?

Solution
With newer versions of conjure-up, you need to first configure a public cloud. Run one of the following commands based on what public cloud you want to see as an option (and follow the interactive prompts):

juju add-credential aws
juju add-credential azure
juju add-credential google

How Do You Troubleshoot the Python3 Error “No such file or directory: ‘/usr/local/lib/python3.6/site-packages/” on RHEL 8.x?

One or more of the following problems are happening to you:

Problem scenario #1
You run python3 setup.py install on RHEL 8.x, but you get an error message like this:

running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/test-easy-install-52191.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/lib/python3.6/site-packages/

This directory does not currently exist.  Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).

Problem scenario #2
You try to "--install-dir" flag, but you get a message like this: error: option --install-dir not recognized

Problem scenario #3
You saw an error message about "error: bad install directory or PYTHONPATH", but you do not know what to do.

What should you do?

Solution

  1. First, identify which directory is attempted. sudo python3 setup.py install --prefix=/tmp
  2. Secondly, find where the site-packages (or most child, or most "sub", subdirectory) that was in the first error. Run a command like this (but replace "site-packages" with the most child subdirectory in the error): sudo find / -name site-packages -type d
  3. Figure out how to use the --prefix= option based on the findings of the above. We do not recommend using absolute paths to have logic to get the directory to be passed (for this specific purpose of using setup.py). We recommend using relative paths. Here is an example that could work:

sudo python3 setup.py install --prefix ../..