Blog Series: Monitoring using PowerShell: Part three – Using Powershell to monitor Unifi Controllers

Hi All,

My next couple of blogs will be a series of blogs where I will be explaining on how to use PowerShell for the monitoring of critical infrastructure. I will be releasing a blog every day that will touch on how to monitor specific software components, but also network devices from Ubiquiti, third-party API’s and Office365. I will also be showing how you can integrate this monitoring in current RMM packages such as Solarwinds N-Central, Solarwinds RMM MSP and even include the required files to import the  monitoring set directly into your system.

Continue reading

Blog Series: Monitoring using PowerShell: Part two – Using Powershell to monitor Dell systems

Hi All,

My next couple of blogs will be a series of blogs where I will be explaining on how to use PowerShell for the monitoring of critical infrastructure. I will be releasing a blog every day that will touch on how to monitor specific software components, but also network devices from Ubiquity, third-party API’s and Office365. I will also be showing how you can integrate this monitoring in current RMM packages such as Solarwinds N-Central, Solarwinds RMM MSP and even include the required files to import the  monitoring set directly into your system.

Continue reading

App-V screenshot

Blog Series: Monitoring using PowerShell: Part one – Using PowerShell to monitor MegaRaid

Preface:

Hi All,

My next couple of blogs will be a series of blogs where I will be explaining on how to use PowerShell for the monitoring of critical infrastructure. I will be releasing a blog every day that will touch on how to monitor specific software components, but also network devices from Ubiquity, third-party API’s and Office365. I will also be showing how you can integrate this monitoring in current RMM packages such as Solarwinds N-Central, Solarwinds RMM MSP and even include the required files to import the  monitoring set directly into your system.

Continue reading

Blog Series: Monitoring using PowerShell

Hi All,

My next couple of blogs will be a series of blogs where I will be explaining on how to use PowerShell for the monitoring of critical infrastructure. I will be releasing a blog every few days that will touch on how to monitor specific software components, but also network devices from Ubiquity, third-party API’s and Office365. I will also be showing how you can integrate this monitoring in current RMM packages such as Solarwinds N-Central, Solarwinds RMM MSP and even include the required files to import the  monitoring set directly into your system.

Continue reading

Mini-Blog: How to use Azure Functions to run PowerShell scripts

 

Lately I’ve had a couple of scripts that needed to run on a daily basis, in the past I used the task scheduler on a server for this but that would mean I had to mess around when passwords that expired, and all the other misery that is related to standard scheduled tasks.

To work around all the known limitatons I’ve created a new Azure Function App. Azure Functions allow you to run scripts at timed intervals which you set. To learn more about Azure Functions you can find information here

Continue reading

Mini-Blog: Creating HTML files from CSV

We use a documentation system that only allows CSV exports, which gets annoying when tyring to supply clients with some form of data out of it. To resolve I rewrote the script by Brandon Everhardt to take all CSV files from a folder and export them into a single readable HTML file. It’s a very quick and dirty script, using the ConvertTo-HTML function to make a somewhat more readable approach.

The result looks like this:

Continue reading

Mini-blog: Wait for VM to come online, then execute Powershell direct

During my labbing I’ve noticed I often need to wait for the VM to get online before executing some script or commands, to do that I use the following script:

First we get the VM Name, and enter the credentials for that specific VM:

$VMName = read-host "Please enter the VM-Name"
$VM = get-vm $VMName
$cred = Get-Credential -Message "Please enter credentials for the VM"

By getting the VM status we can use the VM.Heartbeat to check the actual status. We’re currently counting on the VM to be an unmonitored VM so the result we expect is “OkApplicationsUnknown” – This means the OS is up but the hypervisor has no idea if the VM applications are “healthy”.

To wait for the VM to get online we use a while loop to keep checking the heartbeat and if the status changes.

do
{
$VM = get-vm $VMName
} while ($vm.Heartbeat -ne "OkApplicationsUnknown")

Directly after the loop we are sure the VM is online, so we can execute our script via PowerShell Direct, here I simply print the hostname. 🙂

invoke-command -vmname $vmname -Credential $cred -ScriptBlock {write-host "My name is $env:COMPUTERNAME"}

Happy scripting!

App-V screenshot

Using App-v to deploy Office 2016 on RDS servers

Hi All!

At my current employeer we have a lot of clients that use RDS servers, in the SMB often you see that applications are installed directly on the RDS server. That means that if you have a Highly Available solution there often is a difference between applications installed.

To prevent this we use Microsoft’s App-V for RDS servers. App-V is included in your RDS Client Access Licenses so in essence its “free”. The cool thing about app-v is that by using application virtualisation you no longer have to install any application but simply publish them to the users or computers you want them to run.

To learn more about app-v you can check this technet page.

Microsoft has really embraced app-v as part of the OS and it is now installed by default on Server 2016 and Windows 10. To start with App-V we will create a package, and publish it on a RDS2016 server without using the rest of the app-v infrastructure. This is called a “Stand-Alone app-v deployment”

Requirements:

  • A preconfigured RDS 2016 server.
  • The Office 2016 Deployment toolkit found here
  • XML file with the features you want in your App-V package from here

First we will configure our RDS2016 to be able to run App-V packages, to do that run the following command as administrator within PowerShell

Enable-Appv
Set-AppvClientConfiguration -EnablePackageScripts $true
restart-computer

After restarting you can check the app-v status with the following powershell command

Get-AppvStatus

With the above commands we do not only enable App-V but also “package Scripting”. Packages with extended functionality such as office require the running on scripts within the app-v packages. The default setting forbids any scripts from running for security reasons.

After you see that App-v is enabled we can move on to creating the app-v package. To move on we download the Office Deployment Toolkit and our XML file to C:\ODT, we rename the XML file to “SETUP.XML” Then we open a CMD.EXE window as administrator and enter the following command:

C:\ODT\SETUP.EXE /PACKAGER C:\ODT\SETUP.XML C:\ODT\APPVPackage

The setup will now run and create a App-v package out of the selected office components, after the setup completes you can copy C:\ODT\AppvPackage to a location of your choice. I’d advise to collect all of your application packages on a DFS-R share but for the purpose of this lab the location does not truly matter.

After copying the files you execute the following Powershell command to make the package available for the RDS 2016 machine:

Add-AppvClientPackage -Path "<PATH TO YOUR APPV file>" | Publish-AppvClientPackage -Global | Mount-AppvClientPackage -Verbose

To only make the package available to a specific user you can execute the following powershell command as administrator:

Add-AppvClientPackage -Path "<PATH TO YOUR APPV file>" | Publish-AppvClientPackage

And to finish you simply mount the file as the end-user by running:

get-appvclientpackage -all | Mount-AppvClientPackage -Verbose

And tada; you’ve deployed office to the RDS without installing the actual software. You’re currently running Office in a virtual bubble. When running this in production I’d truly suggest looking into an App-V Publishing server to make management much easier. 🙂

Free online powershell training

Hi all!

After a couple of weeks of silence I have some great news; I will be giving free online powershell courses for beginners and intermediates. Hopefully I’ll be able to assist some of you in questions you have about your own scripts, or scripts you’ve used from my blog.

The first course will be August 7 at 19:00 GMT+1. You can join the course by emailing me at Kelvin [at] Limenetworks.nl or via the following Skype for Business URL: Skype for Business Meeting

In the first course I will be focusing on using Powershell in your day-to-day operations and automating minor tasks. It’ll be hands-on as much as possible and not only focus on theory. there will be room for questions during the one hour course.

Hope to see you there!

Mini Blog: Checking processor performance

I haven’t been blogging alot lately, mostly due to renovating at home and having very large projects in the office. To compensate I’ve decided to write some quick mini blogs to make sure I don’t lose the magic 🙂

I’ve found with some application monitoring I’ve been setting up it was required to make a quick snapshot of how heavy the processor was being used during my scripts, as the application made some SQL queries it could create spikes in the CPU that I wanted to avoid.

To take a quick snapshot of the current values of the processor status, I’ve used the get-counter cmdlet and retrieved the cooked value of this to query it further;

$CPUQueueLength = (get-counter -counter "\System\Processor Queue Length").countersamples.cookedvalue

$CPUUSerTime = (get-counter -counter "\Processor(*)\% User Time").countersamples.cookedvalue

$CPUPrivTime = (get-counter -counter "\Processor(*)\% Privileged Time").countersamples.cookedvalue

Happy scripting 🙂