Posts

Showing posts from February, 2016

NetScaler InSight Center Authentication Delegation

Image
Whenever I'm called to setup or troubleshoot Citrix NetScaler performance issues, I try to bring Citrix InSight Center into the game.

InSight Center is a Linux based Virtual Machine which gathers AppFlow performance data from the NetScaler thus helping with performance troubleshooting.

I am not a fan of local user accounts on any system for many reasons, so I'll show you how to delegate the user authentication of the InSight Center to Active Directory.

Let's start with logging on to the InSight Center using the default administrator account "nsroot" and navigating to the "Authentication" node under "System". Here we see all the available authentication methods supported: RADIUS, LDAP and TACACS. Since we want to delegate the authentication to Active Directory, we're interested in LDAP.


Select the "LDAP" methods, and then click "Add" to add a server. Fill in the IP address of a domain controller (or a Load Balancing VIP…

Powershell Event Log Filtering

I run across a fairly old Powershell script today that I had to use in order to get some information from the Security log of a Domain Controller. The domain controller has been around for a long time and the log was a bit large.

I run the script once and it took forever to complete so I decided to take a look under the hood...

First of all the script was using the Get-EventLog cmdlet which isn't the best thing...

I examined the script for the event id's of the entries we would like to get and then I replaced the Get-EventLog and Where-Object cmdlets with the Get-WinEvent and the XML filter for the events.

You may wonder, how are we going to build the XML filter for the WinEvent? Well, I'll show you a little trick. First we open Event Viewer, select the log and then select "Filter Current Log". A window will pop up and you'll have to fill the necessary fields. Wait, don't hit "OK" yet, switch to the XML tab and copy the query text.

Next, we'…

Powershell Property Rename

Image
When using Powershell, we sometimes have to change the names of the properties returned by a cmdlet. There are many reasons for doing this, take exporting data as an example. You want to export an array of objects and set custom property names in order to format it as requested.

Another important reason for changing the name of a property it passing objects down the pipeline. When using the pipeline, the property may be named differently that the parameter name for the next command. You'll run into this kind of problems when using cmdlets from differents modules like ActiveDirectory and Exchange. A property may be named "ComputerName" for an AD cmdlet and "Server" for an Echange cmdlet.

Let's see what you can do about it...

For example, we want to test network connectivity on port 389 towards all domain controllers. First we will get the list of the domain controllers using the cmdlet Get-ADDomainController and then we will test connectivity using Test-Net…

Windows Server 2012 R2 Evaluation Upgrade

Image
Sometimes you just have to fire up a Windows Server system in order to test something and if you're like me, you'll create a new virtual machine for this purpose.

Most of the times, I create a VM using an evaluation copy of Windows Server since the evaluation period is more than enough and the client may not have the necessary license.

There are times however when I had to license an evaluation copy!

So, let's cut to the chase!

I used the DISM tool to get the current edition of the OS and the supported target editions and perform the upgrade.

Start by opening an elevated Powershell window and run the command:

dism /online /get-currentedition

From the output you can see that the server is running ServerStandardEval edition. Let's get the supported upgrade editions by running: dism /online /get-targeteditions and since ServerDatacenter is supported, will upgrade to that using: dism /online /set-edition:serverdatacenter /productkey:<your-product-key> /accepteula
Aft…

Powershell COM Object Disposal

I run into a strange issue with one of my Powershell scripts the other day, I was using an Excel COM object and I had an Excel process even after calling the objects Quit() function.

All the script was doing was to open an Excel xlsx file and save it as csv file. I could use the Get-Process and Stop-Process cmdlets be I would like to be able to schedule the script to run and not be afraid that it would kill any other Excel processes running at the same time.

After a few searches I found out that I could release the COM object with the following command:

[System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel)

Here we are releasing the COM object excel using the Interopservices. Before doing this, make sure that you have saved your work done using the COM object.

Windows 2012 R2 and Windows 8.1 Partition Resize

Unlike on their predecessors, on Windows Server 2012 R2 and Windows 8.1 (and later), you can resize the system partition online without having to shut the OS down.

And since I've got a thing for Powershell, I'll suggest a couple of cmdlets that will get the job done.

First of all, you have to make sure that there is unpartitioned space on the disks. In most cases you'll be expanding a virtual machine's partition so you'll have to resize the virtual disk first.

The cmdlet we're going to use is Resize-Partition and you can find the definition here. Before we start resizing we have to identify the disk number of the disk and the partition number. The Get-Disk cmdlet will help you with the disk numbers and the Get-Partition with the partition number.

When you have the partition and disk number, you have to decide the new partition size and you're ready to resize.

If you want the partition to take up all the free space left on the disk, you can use the Get-Part…