How To Install PowerShell Community Extensions

Problem Scenario:  You want the rich features provided by PowerShell Community Extensions (also known as PSCX).

Solution:
1.  Download the .msi from this link
2,  Double click it. 
3.  Install it by accepting the License Agreement and the defaults. 
4.  Open PowerShell as Administrator. 
5. In PowerShell, Change directories to where it was installed (e.g., C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx). 

How To Integrate Perl, Ruby, and Python Programs

Problem scenario
You want a Perl program to call a Python program to call a Ruby program to call another Python program.  You are using Linux as the OS.

Solution
Here is a one-line Perl program (course.pl) that calls a Python program:

system( “python /home/ec2-user/cont.py”);

Here is a two-line Python program named cont.py.  It invokes a Ruby program.

import subprocess
subprocess.call([‘ruby /home/ec2-user/integration.rb’],

Windows Server 2012 Scheduled Tasks Are Not Launching PowerShell Scripts Properly

Problem scenario:  For no apparent reason, Scheduled Tasks are not kicking off PowerShell scripts.  You have configured Scheduled Tasks to launch .ps1 files.The task calls “%windir%\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe” (in the Action tab’s “Program/Script” field) with an argument like this C:\Program Files\good script.ps”

You manually run the scheduled task (by right clicking its name and choosing Run) and the Scheduled Task will seem to run.  In reality, the .ps1 file will not execute (despite having the correct Execution Policy). 

PowerShell Can Throw a SetInfo With 0 Argument(s) Error When Creating a User

Problem scenario
You run a PowerShell script that has a command setinfo.  For example, the script is like this:

        #…
        $userName = ‘jdoe’
        $compName = $env:COMPUTERNAME
        $cona = [ADSI]”WinNT://$compName”
        $user = $cona.Create(‘User’,$userName)
        $user.SetInfo()

You get “Exception calling “SetInfo” with “0” argument(s): “The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements.”

You may go to Administrative Tools ->

System 5 Error in Windows Server 2012

Problem Scenario:  In Windows Server 2012 from a command prompt, you run a .bat file that launches a PowerShell script.  You get an error that says “System Error 5” and “Access is Denied.”

Solution:  Open a new command prompt as an Administrator.  Click the Windows button, search for “cmd.”  Right click the cmd prompt chose “Open as Administrator.”  Try running the .bat file again.

If that does not work,

How to Resolve a Puppet Error About Unclosed Quotes

Problem scenario
When running “puppet agent -t” on a Windows server with Puppet Agent installed and configured, you get an error like this:  “Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Unclosed quote after “”” followed by …”

Solution
For the relevant manifest, verify there are no unclosed quotes.  Then verify that you are using double backslashes in any path with a backslash “\”. 

How to Use Conditional Logic With A Puppet Manifest For Executing a Command

Scenario:  You want an exec command in a manifest to be invoked only if a certain file is on the Windows Server.  You do not want the execution of a command to happen if a file does not exist in a certain location.
Solution:  Incorporate the following lines into your manifest (.pp file).
exec { ‘cont_int”:
    command => “echo continual > contint.txt”,
  

How Do You Find Out if The Server Has Puppet Master or Puppet Agent?

Problem scenario
Assuming that you know Puppet is installed, you want to find out if you are on a Linux server that has Puppet Master or Puppet Agent.  This posting applies strictly to Linux or Unix.

Solution
Run this command:
cat /etc/puppet/puppet.conf
Then use “ip addr show” (or ifconfig) to verify the IP address of the server that you are on. 

How To Troubleshoot the mkfs.ext4 Utility

Scenario / Goal: You are trying to add a hard drive (or new storage) to a Linux server.  You want the drive usable.  You attach the drive and use fdisk.  Now you want to use mkfs to create a file system on it.

Problem: You are trying to use mkfs.ext4 but you get this error:  “mkfs.ext4 no such file or directory while trying to determine filesystem size.”