Tag Archives: PowerShell

PowerShell: Friday Script Blitz 3

 224edi

Intro

Happy 2018!!! In my current position I’m getting to do a lot of PowerShell scripting. Typically these are quick scripts for maintenance or finding information about our Citrix environment. I’m posting several here to share.

NOTE: These scripts were written against a XenApp 7.9/PVS 7.15 environment

get-pvsPersonalityStrings.ps1

If you have to maintain unique personality strings on your provisioned devices, then this script will help. It spits out all the strings in a PVS farm. I wrote this script due to a requirement with Symantec AV that expects to see a unique hardware ID for servers connecting to it. One way to do this in provisioned environments is with a startup script. See How to prepare Symantec Endpoint Protection clients on virtual disks for use with Citrix Provisioning Server for more info.

Get it from GitHub

set-pvsPersonalityString.ps1

The companion script for above. This script will set the Personality String for a PVS Device. It can take an input or generate one automatically. It assumes a 32 character hexadecimal string.

Get it from GitHub

Thanks for reading,
Alain

Advertisements

PowerShell – Add PowerShell to Context Menu

holiday-hacks
Here’s a holiday hack for PowerShell. If you would like the ability to right-click on a directory and have PowerShell open to that directory here’s what you do…

  1. Open the registry on the system you want to do this on (regedit.exe)
  2. Navigate to HKEY_CLASSES_ROOT\directory\shell

Image 001

  1. Right-click and create a new key called PowerShellPrompt

Image 002

  1. Rename the Default Data to “PoSH Here” or something similar. This is what will display in the context menu when you right-click

Image 003Image 004

  1. Right-click on the PowerShellPrompt key and create a new key. Name it Command

Image 005

  1. Change the Default data to the following command-line
powershell.exe -noprofile start-process  powershell.exe -verb runas -argumentlist "{ -noprofile -noexit cd %1}

Image 006

  1. Now, when you right-click on a directory, An elevated PowerShell prompt will open at that directory

Image 009

  1. If you want to load your profile when this prompt opens, remove the second “-noprofile” from the command-line
powershell.exe -noprofile start-process  powershell.exe -verb runas -argumentlist "{ -noexit cd %1}"
  1. If you want to have an Icon show up in the Context menu add the following String value to the PowerShellPrompt key

Image 011Image 012
Thanks for reading,
Alain

WAGTHEREAL DIGEST – OCTOBER 28 2017

1yd2ci
A list of articles/blog posts to review, research, or archive

Thanks for reading,
Alain