How to get a Bearer Token from Citrix Cloud for API access, using PowerShell

Wanted to share a quick PowerShell code snippet.

I used this to get a Bearer Token from the Citrix Cloud API trust service using PowerShell.

It’s not beautiful, but it gets the job done.


You’ll need:

  • The clientID and clientSecret from your Citrix Cloud customer API client (how to do that is here)
  • Your customerID for your Citrix Cloud instance

Then put those in-between the relevant quotation marks in the code snippet πŸ™‚

PowerShell code snippet



Citrix Remote PowerShell SDK error: “Could not establish trust relationship for the SSL/TLS secure channel with authority ‘localhost’.”

If you see the following error when trying to run cmdlets from the Citrix Remote PowerShell SDK

Check and make sure you are running PowerShell in its 64-bit flavour, and not 32-bit (x86).


I had this issue recently when automating some tasks with Jenkins talking to Citrix Cloud, using the Citrix Remote PowerShell SDK:

On the same host as Jenkins, if I ran a PowerShell shell, and ran the exact same script, it’d work fine.

If I ran it in Jenkins, it would fail with an error like this:

Root Cause

The root cause is there’s something up with 32-bit PowerShell and the Citrix Remote PowerShell SDK.

Jenkins runs the 32-bit version of PowerShell because Jenkins itself is 32-bit. The reason the script worked in a PowerShell shell on the Jenkins host, was because the default on Windows is 64-bit PowerShell. As soon as I forced PowerShell 32-bit, I could reproduce the problem.

The Fix

The fix is to force Jenkins to use PowerShell 64-bit. There’s two options I found:

  1. You can workaround it with some good tips here:
  2. Or you can fix it fully by making Jenkins run on 64-bit Java:

Context is Queen

Want to improve your workplace communication skills, especially when working with other teams?

Give context.

Why give context?

Context helps your colleagues:

  1. Understand where you’re coming from / viewing things from.
  2. Understand who you are, and what you’re trying to achieve (your overall project, not this specific request)
  3. Helps remove assumptions. Teams often have their own dialects, and your request may mean something entirely different to them. Giving context helps them understand if there might be other dialects in play.
  4. Saves them time in “back and forth” clarifying questions, which, if the teams are remote, can take days.

Context helps you too:

  1. It saves you time in the long run – you’ll reduce the amount of “back and forth” while the receiving party tries to figure out exactly what you need.
  2. You might not actually need the thing, or need to do the thing. The team you’re asking may already have done something that can help you. But if you just ask for “$thing” you’ll never know, because they don’t know your project/goal!

A worked example

Here’s an example I used on Twitter recently:

Bad: “I need $thing”

Good: “I’m from $group. I’m trying to help $team with $companyGoal, to do $workItem, and need help with $thing”

This difference this makes can be stark, and it usually only takes a few minutes more:


I need a new SSL certificate


I’m from the web applications team. Our SSL certificate will run out soon (we’re trying to automate renewals but we’re not there yet), and I need the new cert to prevent our web app from going offline next week. Can you help please?

If I received the first request. I give them the cert.

If I receive the second request, I can tell them all about the solution our team developed to help developers with certificate management and auto renewals!


So please, do yourself, and your colleagues a favour – give context! πŸ™‚

A quick Citrix microapp hack to get notifications when there’s a Citrix Security Bulletin

Credit to Gabe Carrejo and the Patrick Quinlan for their work on this.

It’s possible to use the Citrix Support Security Bulletin RSS feed with Citrix microapps to notify you (or a group) when there’s a new Security Bulletin from Citrix

Rough Steps:

  1. Copy this RSS URL:
  2. If you want to narrow the feed down to a specific product or category, look for the category tags in the RSS feed and add them when you add the RSS integration in step 3
    • Some examples, in case they help:
  3. Follow the RSS microapp guide here and replace the blogs RSS URL with the Security Bulletin URL:

Of course, you don’t need to use microapps to get Security Bulletins (you could just use an RSS reader) but it’s a very neat use case – and combined with Push Notification with Workspace, means you get a notification to your phone when there’s a new Bulletin. Great idea, Gabe!

A full list of feeds available from Citrix Support are here:

Life stuff: Things I’ve learned about dealing with sweat

I’ve acquired some hilarious pairs of oxymoronic genetic traits. My most favourite is probably that I’m built for sports, but sweat like crazy. Like, ridiculous amounts. To the point that my “sweat wicking” t-shirts wet out and end up slowing me down. Thanks, genes?

Anyway, this sweaty-ness is a pain outside of sports too – especially my arm pits. And I know this problem makes a lot of people self conscious, so here’s all the stuff I’ve learned about controlling it and dealing with it over the last decade or so.

One caveat here: This is what’s worked for me. It might not work for you. But, let’s try anyway…

Finding a strong / good enough antiperspirant

If you sweat a lot, like me, you need a specialist antiperspirant. And to be clear, Deodorant is not Antiperspirant. A regular deodorant will not stop you sweating.

Axe/Lynx, Sure, Mitchum, all the regular antiperspirant stuff, wasn’t strong enough to stop my super sweat. So I had to upgrade to something more specialist. Finding what worked for me took a lot of experimentation, so I’m sharing what worked (or didn’t) for me.

The strongest

The strongest/best I used was:

Both of these are available in the UK from pharmacists like Boots and Superdrug, and some supermarkets. However, while they worked awesome by stopping all my arm pit sweat, they ended up irritating my skin, to the point that I’d be in pain at night before I went to sleep. Your experience may differ, though (I hope it does!)

Finding balance

For the last 8 years or so, I’ve settled on the following two:

Every day:

  • Sure Maximum Protection. It comes in a 45ml size, and is available in both genders scents – and you can get it in regular UK supermarkets, so it’s easy to find. It’s strong enough to keep me mostly dry, but doesn’t irritate my skin. In the US, it’s called Degree Clinical Protection. I wish brands were consistently named across regions – it’d be so much easier to recommend things to fellow people on the internet πŸ™‚

For super stressful times (like, if I need to speak at a major vendor conference…):

  • Triple Dry Roll-On. Specifically the roll on, not the sprays. This is stronger than the Sure Maximum Protect, but doesn’t irritate my skin as quickly as the Strongest ones I listed above.

Dealing with sweat on clothes

Sweat is a massive pain in the arse on clothes. Over time (and not even that long) bacteria builds up in the arm pit area and when you do sweat, your clothes (and you) smell. If I washed my clothes on a hot wash to try to combat this, they just end up looking faded. Damned if you wash at low temperature, damned if you wash at a high temp πŸ˜‰

When I used to wash at low temps, the build up of bacteria led to me putting a lot of my clothes in the “re-purposing” bins where they’re converted into rags, because it’s not fair to donate them to charity and there’s no way I’d just throw clothes out into the general rubbish/land fill. But to be more environmentally friendly, I wanted them to last longer.

Here’s some things that do work pretty well for me

Sports Clothing

Polyester and other synthetic fabrics which are great for sweat wicking, also harbour different, smellier bacteria than say, cotton. When the bacteria get wet, that’s when the smells appear again πŸ™

The best ways I’ve found to prevent or remove odour from my sports clothing includes:

Removing smells

  • White vinegar: Soak your clothes in a 200ml of white vinegar + 2litres of warm water (~40c is fine) over night. Then wash normally – but do not use fabric conditioner (more on that shortly). Don’t worry, the vinegar smell won’t stay πŸ™‚ This works especially well for smelly football training bibs!
  • I’ve also experimented with using Dettol Anti Bacterial Laundry Cleanser (available from most supermarkets in the UK). I think it’s meant for washing baby clothes, but it seems to kill the arm pit sweat bacteria pretty well. I’ve only been using this for about 6 months or so. You just put it in the fabric softener compartment in your washing machine as part of a normal wash (but again, don’t use fabric softener as well!)

Preventing smells

  • Do not use fabric conditioner. Do not, ever, ever-ever-ever! use fabric conditioner/softener on synthetic clothing, including sports clothes. It makes them smell worse, and it prevents their sweat wicking abilities from working.
  • Use whatever detergent you need – my preference is liquids, and especially liquid laundry soap, as it washes out easily. I find that powders tend to stay in the fabric and stiffen the fabrics over time (again, your experience may differ), so I just use liquids now.


Cotton clothing

Cotton for me tends to take longer to start smelling than synthetic fabrics, but they do often end up smelling.

Consider wearing white?

Curiously, I’ve observed that my white t-shirts don’t seem to smell in the arm-pit area even after a long time, and I wonder if there’s some different/special in laundry detergents meant for whites that causes that? Maybe there’s bleach in there or something that just totally nukes the bacteria.

Removing/preventing smells:

T-shirt armpit strategies:

  • Using Dettol Anti Bacterial Laundry Cleanser: I turn my cotton t-shirts inside out, and using a cheap spray bottle with 50% water and 50% Dettol laundry cleanser, spray the arm pit area just before running my washing load.
  • White vinegar: Same as above, 50/50 mix with water, spray on arm pits – but this time, leave it an hour or so before washing. It just seems to take a bit longer, probably because it seems more “gentle” than Dettol.

After doing either of the above, wash normally, and with cotton youΒ canΒ use fabric conditioner (indeed, you should! or your clothes won’t last as long in my experience). Spraying my arm pits does seem to be slowing down how quickly my cotton t-shirts smell – but I’ve only been experimenting for about 6 months.

Don’t soak coloured clothing overnight in white vinegar: it’ll fade the clothes, in my experience.

Dealing with where the sweat goes next

Just because you stop sweating in one place, doesn’t mean you stop it altogether. Nope. It just pops up in other places instead! Yay.

Groin rub 😐

Some additional sweat, plus my genetic thunder thighs, means I tend to get a groin rub chafing rash thing going on – especially as I cycle to work and tend to walk a lot at weekends. To combat that, I use Udderly Smooth Chamois Cream, daily. It’s amazing, and very cost-effective. Unfortunately, I haven’t seen it in supermarkets, but it’s readily available on Amazon and places like cycling stores online. It’s available in the US and the UK from the looks of things.

If I can’t get Udderly Smooth, I use Lanacane Anti-Chafing Gel. It’s good (and a good size for travel) but is less cost-effective, in my experience.

Wet snowboard boots

When I snowboard, my boots used to get super wet. I assumed they were leaking, but nope! It was my feet sweating. So now when I snowboard I use a standard antiperspirant spray on the soles of my feet and since I started doing this my feet are much drier – yay!

Sweaty feet, trainers, shoes

I rotate footwear daily. I almost never wear the same pair of trainers every day – which lets them air out between days. I’ve found this stops my shoes/trainers smelling.

K, I’m done

I think that’s it. Hopefully some (all?) of this helps. If it does, let me know. And if you have other ways of coping with sweat, let me know too – I’m always happy to learn new stuff! πŸ™‚