How Do You Automate a Process That Involve a GUI Operation with Powershell?

Question:  How Do You Automate a Process That Involve a GUI (e.g., to save an .xps or .oxps file) Operation with Powershell?  You do not want any part to be interactive.

Solution:  This applies to PowerShell version 4 and above.  This will save the content of c:\temp\contint.txt to goodName.xps in the default folder (often the user’s Documents folder) without needing to attend to the process.

# These three lines (starting with “Add…”,

How Do I Know If I Have a Safe Version of NTP on a Linux Server?

Question  How do I know if I have a safe version of NTP on a Linux server?

Background  The United States Computer Emergency Readiness Team’s website indicates that this many versions of NTP are susceptible to a denial-of-service attack.

Answer  Run this command:  ntpd –version

The output should look something like this:

ntpd 4.2.8p9

If it is lower than that (e.g.,

How To Install and Configure Salt Stack on RedHat Linux (AWS Instances)

Problem scenario
You want to install SaltStack on RHEL instances for the first time on an AWS server.

Solution in Three Parts
(If you want instructions on how to do this with Debian/Ubuntu and/or Linux SUSE, see this posting.)

Part 1  Create a Salt Master Server
1.  Create a RHEL instance and put it in a Security Group that has access to the Internet for this initial setup,

How Do You Use Conditional Logic on PowerShell Variables To Test If They Are Empty When The Variable’s Value Can Span Two Or More Lines?

Problem scenario:  Sometimes variables get values you do not expect.  Handling these exceptions is the mark of a good programmer.  

A PowerShell variable (e.g., $contint) may have the following content:

second line
third line”

When a variable’s value can span lines, conditional tests act unpredictably when they use such a variable.  For example a conditional test of the variable like this 

In PowerShell, how do you convert an array value into an integer value?

Question:  In PowerShell, how do you convert an array value into an integer value?

Answer:  Assuming that the value is an integer (e.g., not value that is legal for an array but not an integer), do the following:

1.  Write the array value to a file.
2.  Use the key word trim to eliminate blank space or other characters that would not be supported by the integer data type.

How do you troubleshoot a CM tool doing an unattended installation on Windows Server 2012?

Problem scenario:  Using a CM tool, you transfer a PowerShell script to do an unattended installation on Windows Server 2012.  The CM tool transfers the media and the PowerShell script and launches the script once transferred. However, when you log into the Windows Server, you do not see the application installed.  When you manually run the PowerShell script and transfer the media over, there is no problem.  You want the CM tool to do the installation (transfer of media and execution of the PowerShell script).

Troubleshooting Ansible With Windows Managed Nodes

Problem scenario
When running various Ansible operations, such as “ping,” result in an error like this “SSL: 500 WinRM Transport. [Error 104] Connection reset by peer.”  What should you do to get Ansible to work with Windows managed nodes?

Solution

Prerequisites
Install pip. If you need assistance, see this posting.

Procedures
Upgrade pywinrm to 0.2.2. 

How Do You Boot To CD/DVD-ROM (or USB stick) on an HP Laptop one time?

Question:  How Do You Boot To CD/DVD-ROM on an HP Laptop one time (e.g., to reformat it)?

Answer:

  1. Turn off the laptop.
  2. Turn on the laptop, and when it is booting up, press Escape.
  3. Then choose option “F11” for System Recovery.
  4. You’ll see a screen for “Choose an option.”
  5. Select “Use a Device.”
  6. Then select “Internal CD/DVD-ROM Drive (UEFI)” (or the USB stick option).

Ansible Documentation Appears To Have Errors

Ansible’s documentation (http://docs.ansible.com/ansible/intro_windows.html#inventory) indicates that inventory variables (in .yml files) are assigned with colons (“:”) and not equals (“=”) signs.  However in practice, equals (“=”) signs are necessary for key-value assignments and colons (“:”) do not work.  If you have found their documentation to be correct, please post a comment.

How to Install Virtual Machine Manager on Ubuntu 16

Problem Scenario:  You want to run VMs on your Linux server.  You are running Ubuntu 16.  You want to install Virtual Machine Manager (a free software package).

Solution:
1. Run this command to see if you have processors that can support virtualization:
sudo cat /proc/cpuinfo | grep -c svm || cat /proc/cpuinfo | grep -c vmx

If the result shows a 1 or higher,