Wow, it’s been a while since I’ve done a real post on this site. I’ve got many interesting things to discuss, but it has been a great last few years. More to come, but mainly, I’m just moved hosting providers and onto a VPS server.

It’s been a while since I’ve posted. Way too long. I’ve had this script for quite a while that I wanted to share with the world. LogicMonitor is releasing a new REST API which requires some session based login. This script helps you obtain that session and download the audit log for the last hour. You’ll have to modify your timezone settings (in the AddHours lines, currently set for EST).

Here’s the script:

$user = "username"
$pass= "[email protected]"

#get epoch time for current and x hours before
$date1 = Get-Date -Date "01/01/1970"
#get start time
$date2 = (Get-Date).AddHours(4)
$epochStart= (New-TimeSpan -Start $date1 -End $date2).TotalSeconds
#get end time
$date2 = (Get-Date).AddHours(5)
$epochEnd= (New-TimeSpan -Start $date1 -End $date2).TotalSeconds
#round the time to not have decimals
$epochStart= [math]::Round($epochStart)
$epochEnd= [math]::Round($epochEnd)

$filter = "_all~update" #check LM documentation on filters
$fields = "username,happenedOnLocal,description"
#build uri for access logs
$uri = "https://{account}.logicmonitor.com/santaba/rest/setting/accesslogs?sort=-happenedOn&filter=$filter,happenedOn>:$epochStart&fields=$fields"
#build base64Auth for the header
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$pass)))
#get the events
$events = Invoke-RestMethod -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Uri $uri
$events #display events that were gathered

When using AutoTask’s API it’s required to lookup a various amount of picklist values that are used in updating you’re web request. This is a powershell way to pull those picklist values. The first part of the script validates your AT URI, the second part gets the entity data, in this case I was looking for “ticket” related fields.

Edit: Updated to give a more friendly output

# Username and password for Autotask
$ATurl = "https://webservices1.autotask.net/atservices/1.5/atws.wsdl"
$ATusername = "{AT Username}"
$ATpassword = ConvertTo-SecureString "{AT Password}" -AsPlainText -Force
$ATcredentials = New-Object System.Management.Automation.PSCredential($ATusername,$ATpassword)

$atws = New-WebServiceProxy -URI $ATurl -Credential $ATcredentials
$zoneInfo = $atws.getZoneInfo($ATusername)
$ATurl = $zoneInfo.URL.Replace(".asmx",".wsdl")
$atws = New-WebServiceProxy -URI $ATurl -Credential $ATcredentials
 
$entity= $atws.getFieldInfo("Ticket")
 
foreach ($picklist in $entity) {
	$picklist | select Name,Label,Description | ft
	foreach ($values in $picklist.PicklistValues) { $values | select Label,Value,IsActive }
}

$output= $atws.getThresholdAndUsageInfo()
$output.EntityReturnInfoResults.message

This is a simple script to gather volume information including dedupe schedule and autogrow settings. I’m going to combine this with my snapshot script in the future to make a recommended dedupe schedule based on the average snapshot times.
Read More

Found a solution on the NetApp communities for deleting the Informational events that plague OnCommand Core.

https://communities.netapp.com/message/94591#94591

Read More

Problem:

Gathering snapshot statistics is a tedious task when looking at autosupports and cli output. I needed to gather information about oldest snapshot, average number of snaps per day, total snapshots, and other various information.

Solution:

A powershell script using the Data ONTAP PS Library. Read more for the script.

Read More

Just a quick note about configuring SSH on a Cisco Catalyst 4900M Switch:

Cisco IOS Software, Catalyst 4500 L3 Switch Software (cat4500e-ENTSERVICESK9-M), Version 12.2(54)SG, RELEASE SOFTWARE (fc3)
# conf t
(config)#crypto key zeroize rsa
% No Signature RSA Keys found in configuration.
(config)# crypto key generate rsa general-keys label ssh modulus 1024
The name for the keys will be: ssh

% The key modulus size is 1024 bits
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]
(config)# ip ssh authentication-retries 5
(config)# ip ssh version 2
(config)# line vty 0 4
(config)# transport input ssh telnet

Note: You can leave the “telnet” off vty transport, but if you do ensure that you’ve tested SSH first!

I was tasked with migrating a VMware 4.1 to 5.1 environment. This created a slight issue due to the fact that environment ran vShield. For those of you not familiar, vShield on 4.1 had 2 additional lines in the VMX file that was manually added. These VFILE lines caused the VM not to boot if it was moved to an environment where vShield 1.0 was not present. So to resolve this a script was needed to download all these VMs, remove the lines, then reupload the file with a different name. Well, here you go.
Read More

Script to list all the VMs that exist within your vCenter Server with their datastore.
Read More

Because I always lose them:

Remember —- %ALLUSERSPROFILE%