Titanic Update PSX Script
This article, which will be updated as new scripts are added, serves as an index to the scripts I have uploaded to GitHub with a quick summary of what the script can do and links to explanatory blog articles. The scripts are split logically into a number of GitHub repositories, namely:
Titanic Update PSX Script
Putting this into PowerShell is relatively easy although I tend to use the SQL cmdlets available with .NET rather than relying on the SQLPS module having been installed. A little more code is required to use them but with the advantage that the script should run wherever the .NET Framework is installed.
This will connect to the specified SQL server instance as the user running the script and email a list of all SQL accounts which expire within the next 10 days to the given recipient. If the script fails to connect to the SQL server then an email will also be sent containing details of the error.
If no mail parameters, such as the mail server and recipients, are specified then the output will go to an onscreen grid view, unless -nogridview is specified whereupon the account objects will be output directly so they can be piped into another script or manipulated manually.
Whilst designing a XenApp 7.x infrastructure for a customer, a requirement surfaced that they wanted to be able to update their in-house developed applications, of which there were three separate ones, written by three separate teams, on a weekly basis. Given that they did not have App-V packaging skills, so weekly repackaging would have been cost prohibitive, we looked at using Citrix AppDisks so that we could hand Server 2012R2 virtual machines over to the customer with AppDisks in write mode, let them install and test their apps and then hand them back to us for sealing and promotion to UAT and thence Production. Unfortunately, we hit a number of issues with the AppDisk technology which meant that we had to seek an alternative way of delivering these applications.
This was preferred to using different OUs for the different apps so then only one copy of the startup script was required and the chances of a server being in the wrong OU were reduced, especially in Production where a single OU was used for servers providing these custom apps and those not providing them. The script differentiated between the two types of server via NetBIOS name as a different naming convention was used for those providing custom apps so the startup script could exit almost immediately if the NetBIOS name was not that of a custom apps server and thus not delay the boot noticeably.
In the development environment, where the customer had full control over the share containing their install script and Chocolatey packages and also had local admin access to the XenApp servers hosting their applications, the customer could test their own script whenever they wanted by simply rebooting their development servers.
The whole solution was provided out of two datacentres for resiliency so the solution for these bespoke apps also had to fit within this. To that end, two shares were provided for the UAT and Production environments such that the startup script would examine the IPv4 address of the booting XenApp server and select the installation share local to that datacentre although with a mechanism to fallback to the share in the other datacentre if the local one was not available. Data was replicated between the two shares by way of the script that BAU operations would use when promoting the customers scripts and packages from Development after a change request had been approved. This script had its own sanity checking in such as ensuring that there were actually changes, additions or removals to the files that were being promoted, as it kept a copy of the previous installation files, this being achieved via checksumming files rather than just relying on comparison of file sizes and datestamps.
A pair of events was implemented such that a successful boot and installation would log the one, information event, and a fatal error would give rise to an error event, with descriptive error test, with a different event id, being raised locally on the server. As SCOM was being used, a custom monitor and thence alert was implemented so that the BAU support team had pro-active notifications if any installation failures occurred as these would need investigating and rectifying (which would generally mean another reboot was required once the issue had been identified and resolved).
Of course, one could run it without a filter but that will make for potentially much larger trace files, which could impact free disk space and performance and would take longer to process in PowerShell. I therefore set about trying to figure out how I could add a process id (PID) filter for a specific process via a script and I present the research and relevant script parts here for the benefit of others.
This fortunately is easy to achieve since we can base64 encode the binary file, which converts it to text that we then just assign to a variable within the script. To base64 encode a file and place it in the clipboard so that it can be pasted into a script, run the following:
This script started life because I became aware that my (former) colleagues in customer technical support were performing manual checks for customers at the start of the working day so it seemed obvious to me to automate as much as possible.
The email that the script sends starts with a summary:and then below that there are a series of tables to give specific details on each of these items as well as a per-delivery group summary, including scheduled reboot information, but separately for XenApp and XenDesktop since you probably want to see different information for these.
The script can email a list of the ghost sessions if desired, by specifying the -recipients and -mailserver options (and -proxymailserver if the SMTP mail server does not allow relaying from where you run the script) and if a history file is specified, via the -historyFile option, then it will only email when there is a new ghost session discovered.
If running the script via a scheduled task, which I do at a frequency of every thirty minutes, with -hide, also specify the -forceIt flag otherwise the script will hang as it will prompt to confirm that you want to set any new ghost sessions to hidden.
After creating the original Gex, which released for the 3DO Interactive Multiplayer, PC, Sega Saturn, and PlayStation in 1995, developer Crystal Dynamics sought a sequel in the form of a 3D platform video game in the style of Super Mario 64. The Gex model was rebuilt with this perspective in mind, and much of the game's humor was inspired by Fox's animated television series The Simpsons, on which script writer Rob Cohen had previously worked as a writer. Hundreds of voice-overs were recorded for the character Gex, but hardware constraints forced the Nintendo 64 version of the game to include only around one hundred samples. The Nintendo 64 release, due to hardware limitations, features six fewer levels than its PlayStation counterpart, but the release also includes one exclusive level, "Gecques Cousteau".
The Simpsons made for a noteworthy inspiration for the comedy set-ups based upon the show's popular style of humor. Rob Cohen, a writer from The Simpsons, worked on the script for Gex: Enter the Gecko, particularly Gex's one-liners. The end result of the idea gave Dana Gould over 700 voice-overs for Gex, while giving the character different costumes in order to suit the mood of the levels. When the game was released for the Nintendo 64, over 500 voice-overs from the PC and PlayStation versions were cut out from the original version, giving the Nintendo 64 version roughly over 100 samples to work with for the purpose of the hardware's limitations at the time of development. When Gould was being interviewed for the game, he explained how Gex in the third dimension differed from other platform games at the time. Gould said "The character's natural God-given abilities lend themselves extremely well to designing 3D gameplay." Gould reprised the role of Gex in the game for the American market, although the British version featured the voice of Leslie Phillips instead.
At a high level the steps include retrieving the latest Microsoft Teams Room software deployment kit from Microsoft, executing a PowerShell script to prep the system for recovery, and then initiating the standard Windows 10 reset process.
The first step involves acquiring the latest Microsoft Teams Rooms recovery script by downloading and extracting the most recent MTR deployment kit. This portion can be performed from any Windows computer or even directly on the MTR itself. If a different computer is used then simply copy the extracted files over to the MTR using a USB drive or network share. The example used in this article will perform this directly on the MTR to avoid the need copy the files from another computer. While not necessary it may be helpful to temporarily connect a USB keyboard to the MTR to make it easier to type or copy/paste the commands provided in these steps.
VMware has a KB68079 that details the process should the root password become unknown on a host. Well the same process can be applied and used to update the password on all hosts with that host profile attached. At the time of writing this article, all hosts are compliant with the current host profile, and there are no outstanding issues.
Admittedly this was my first attempt at creating a Powershell script, but thought I would share my journey. We wanted a way to track the location of customer VMs running on our ESXi hosts, and their power state in the event of a host failure. Ideally this would be automated to run multiple times during the day, and the output would be saved to a csv on a network share.
We had discovered a bug in vCenter 5.5 where if the ESXi 5.5 host was in a disconnected state, and an attempt was made to reconnect it using the vSphere client without knowing that the host was actually network isolated, HA would not restart the VMs on another host as expected. We would later test this in a lab to find that if we had not used the reconnect option, HA would restart the VMs as expected on other hosts. We again tested this scenario in vCenter 6 update 2, and the bug was not present. 041b061a72