PowerShell

Having recently changed from using PowerShell ISE to VS Code I’m still discovering all the super awesome new features of it (be sure to get a copy of the Keyboard shortcuts from this page – https://code.visualstudio.com/docs/getstarted/keybindings). To get started I’ve changed the default new file language to PowerShell (not that you can’t change it to anything else though!).

To do this follow the short guide in the screenshots adding in the line shown in the gist below.

Thanks to the organising committee of the (Oxford and Cambridge) College IT Conference 2018 held at the RAF Museum (Hendon) for the invite to talk about PowerShell and Server Core! As promised the video from the presentation is now up on YouTube; in addition the slides as PowerPoint and PDF can be seen below.

  Presentation (PowerPoint) (28.5 MiB, 178 hits)

  Presentation (PDF) (4.9 MiB, 184 hits)

30/03/2018 Update

Microsoft have published this blog post – https://cloudblogs.microsoft.com/windowsserver/2018/03/29/windows-server-semi-annual-channel-update which clarifies the difference between the Long-Term Servicing Channel (Server 2016/2019/so on) against the Semi-Annual Channel. Do have a read!

With thanks to the 50 staff from across the University for attending please see below the links to the videos and PowerPoints of the day!

Direct link to Playlist – https://www.youtube.com/watch?list=PLRxbdlgJzwyjAf820T0u4GpP0E01a9LEX&v=u-GVJ_0VuRM

Slides as PowerPoint

  1 Intro (4.3 MiB, 324 hits)

  2 MDT (85.2 MiB, 407 hits)

  3 PowerShell (27.5 MiB, 313 hits)

  4 PRTG Network Monitor (47.5 MiB, 355 hits)

  5 OpenVAS (32.9 MiB, 308 hits)

  6 WSUS and Chocolatey (60.3 MiB, 341 hits)

  7 NPS and VLANs (10.7 MiB, 381 hits)

Slides as PDF

  1 Intro (2.0 MiB, 309 hits)

  2 MDT (2.2 MiB, 358 hits)

  3 PowerShell (1.8 MiB, 355 hits)

  4 PRTG Network Monitor (3.2 MiB, 370 hits)

  5 OpenVAS (2.3 MiB, 355 hits)

  6 WSUS and Chocolatey (2.9 MiB, 390 hits)

  7 NPS and VLANs (1.4 MiB, 361 hits)

Stay tuned over the coming days for the scripts that are mentioned through the video which will be linked to from this post.

A little bit of fun today with Milestone XProtect (in our case the express version) today; with the goal of improving our documentation I wanted to somehow obtain a list of all of the hardware devices (and to some degree the cameras) including there names, MAC addresses and IP addresses from our XProtect server.

Lone behold the configuration.xml file typically stored at “C:\ProgramData\Milestone\Milestone Surveillance\configuration.xml” held just the information I wanted; a little bit of PowerShell later and I had CSVs with the information in a human readable form.

To do the same on your server follow the guide using the Export-MilestoneConfig.ps1 script show below.

Download Export-MilestoneConfig.ps1 (download from GitHub)

This entry is part 2 of 4 in the series A Windows SysAdmin installs and uses OpenVAS

Following on from the previous post (A Windows SysAdmin installs and uses OpenVAS – End to end guide – Simple Beginnings) in this post we’ll be using PowerShell, OpenVAS and the OMP (Open Management Protocol from Greenbone) to create a Target (a machine/device) to conduct some Pen Testing against, create a Task to scan the target and then generate a report.

The final step is quite possibly the most important though; it’s worth pointing out (hopefully the obvious) that you could have the most amazing Pen Testing software package on the planet but unless you then absorb the reports and take action to Mitigate/Resolve/Eliminate the risks identified it’s all just a horrible waste of CPU cycles.

A quick note – this guide is shown as only a small example of how you can get started with OpenVAS, stay tuned for more in depth guides!

Getting Ready

In this first stage we will download the OMP client for Windows (from http://docs.greenbone.net/GSM-Manual/gos-4/en/tools.html#omp), get it into the right place on our computer as well as create a omp.config file (you can download an example from below) which will provide settings and credentials to the OMP client.

Example OMP File (hosted on GitHub – https://gist.github.com/jamesfed/4ed9be7de2adb83d1d442cc06ea1dbeb).

In addition to follow through with this guide you should download the .ps1 file below which contains the PowerShell code for the steps shown in the screenshots.

OpenVAS-Simple-Example.ps1 (hosted on GitHub – https://gist.github.com/jamesfed/6a5c6634abc12c180f125e25c2764d1f).

Creating a Target

Creating and kicking off a Task

Exporting the Report

Reading the Report

There’s more!

To discover more about the omp.exe tool take a look here – http://docs.greenbone.net/GSM-Manual/gos-4/en/omp.html#access-with-omp.

In the next post of this series I’ll be covering how we can take these simple beginnings and start to build something more in depth through OMP and PowerShell.

If you are running (or use) the Sympa Mailing List but also use Windows PowerShell then you may want to be aware of PSSympa which recently went v1.0 on GitHub and the PowerShell Gallery.

In this release we have…

Functions

  • Get-SympaLogin (to login and get a session cookie – the result of which is used with all other functions)
  • Get-SympaMailingListMember (get the members of a list or list(s))
  • Add-SympaMailingListMember (add a member(s) to a list)
  • Remove-SympaMailingListMember (removes a member(s) from a list)
  • Test-SympaMailingListMember (checks to see if someone is a Subscriber, Owner or Editor of a list)
  • Sync-SympaMailingList (based on the contents of a reference CSV makes changes to the membership of a list)

Samples

  • How a CSV storing credentials might look (samplecredsfile.csv)
  • How a CSV that is used to Add/Remove members in bulk to/from a single list (samplememberslist.csv)
  • How a CSV that is used with the Sync- function would look (samplesynclist.csv)

Super Awesome Features

  • Credentials can be stored in a CSV to avoid them being typed in as part of a wider script
  • Pipeline support for members in lists

How to get it

The PowerShell Gallery is the best route to get your hands on the Module, see this link – https://www.powershellgallery.com/packages/PSSympa for the full details in short though you should only need to run the following command at your PowerShell prompt (assuming you are running a recent version of PowerShell) to install the module on your PC.

Install-Module -Name PSSympa

Continue reading

One of my favourite features of PowerShell is the Invoke-RestMethod cmdlet which (among a great many other things) can download the data from an RSS feed. One application I’ve found for this is to stay on top of security bulletins from organisations like Adobe and Drupal.

However just downloading the data from the feed and kicking it out in an email isn’t quite good enough for my needs thus the script below gets data from a CSV which contains the URL to the feed as well as some extra details to inject into any email notification (e.g. a link to the guide on how to deploy Adobe Updates).

In my production environment this script creates tickets on a FreskDesk helpdesk to log and manage any new update notifications. In the attached example below the script just fires off email notifications.

Have a look at the screenshot sequence below for more info!

  Get-Rss (4.0 KiB, 312 hits)

Update 09/05/2017 – v0.2 – Now handles XML and Arrays in the link and title objects (good for reddit and blogspot!)

So this post is a more a reminder to me than anything else but…having recently come across the Microsoft TechNet article ‘Keyboard Shortcuts for the Windows PowerShell ISE’ (https://msdn.microsoft.com/powershell/scripting/core-powershell/ise/keyboard-shortcuts-for-the-windows-powershell-ise) I thought it necessary to highlight the two keyboard shortcuts….

Ctrl + J – brings up a list of code snippet templates (e.g. try-catch-finally and do-until)
Ctrl + M – expand or collapse braces

See the screenshots below for a demo and do make sure you try them yourself!

Looking for some fun ways to get more out of your your Smart Card deployment? If so have you tried……?

  1. Use Smart Cards to login to your Servers via Remote Desktop
  2. Use Smart Cards with the PowerShell Get-Credential Commandlet
  3. Use Smart Cards with your Firewall for single sign on
  4. Use Smart Cards to login to IIS Web Applications (just a box to tick and a radio option to select)
  5. Store multiple identities on your Smart Card and assign different (and perhaps more complex) PINs to the identities

Have a look at the screen shots below for some more details…

So first things first….the title of this article is misleading; thus far Avid do not seem to have released a sounds pack specific for Sibelius 8 as you will see on the website when you login in (https://my.avid.com/account/orientation) the only option is for the 7.5 sounds pack. But…this works!

Now deploying Sibelius it’s self in a silent manner is (in my opinion) pretty well documented at this link – http://avid.force.com/pkb/articles/en_US/how_to/en396971.

When you get to the sounds the documentation (again in my opinion) (which can be found here – http://avid.force.com/pkb/articles/en_US/How_To/Installing-and-using-Sibelius-Sounds-across-a-network) is flaky at best not to mention the confusion around version 7/7.5/8.

For example the install path is listed as C:\Program Files (x86)\Avid\Sibelius Sounds\Sibelius 7 Sounds, well Sibelius 8 is x64 only so do we put it in the C:\Program Files folder instead? The registry entry is listed as HKEY_LOCAL_MACHINE\SOFTWARE\Avid\Sibelius Sounds\Sibelius 7 Sounds\ContentPath – well again do we update this to be ‘Sibelius 8 Sounds’?

Well as it transpires their guide is correct in all respects; however, as it states in the clear there is no silent install command for the sounds. Ultimately though its just a copy and paste operation with the addition of a registry key so lets use some PowerShell to get this software deployed! Continue reading