• Skip to content
  • Skip to primary sidebar

M.D. Risser's Blog

Just Another I.T. Blog

  • Home
  • Photography
  • About
You are here: Home / Web Development / Javascript / PowerShell Gotcha

PowerShell Gotcha

August 1, 2012 by mdrisser Leave a Comment

I’ve been playing around a lot with PowerShell recently, as I’ve been doing mostly System Administration work in a Windows environment. I have a script that I use to check the servers I’m responsible for, and generate a HTML report from the results.

I decided to add some jQuery to do a bit of client side processing on the report, that’s when I ran into this little gotcha, escaping characters in a string. Like PHP, PowerShell uses the dollar sign “$” at the beginning of variable names, no problem, I’m used to that. In PHP if you want to use “$” in a string without it being interpreted as a variable, you simply escape it with a backslash, like so: “\$”. Not so in PowerShell, you have to use the back-tick character “`” (on U.S. style keyboards this is located under the tilde, “~”, to the left of the number 1. So your escaped string would look like: “`$”.

Just a little something to keep in mind.

Filed Under: Javascript, Lessons Learned, PowerShell, System Administration, Windows 7, Windows Server

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • CCNA Illustrations
  • Outlook 2016 Keeps Asking for Password When Adding Outlook.com Account
  • Dell EqualLogic – Moving the Management Interface to OOB Network
  • Setting Up a Blackhole DNS Server on Ubuntu Server
  • BASH Color Codes in Mac OS X 10.8

Recent Comments

  • admin on Problems Uninstalling WSUS 3.0 (Error 1603)
  • How To Fix 0x00004005 Usmt Errors - Windows Vista, Windows 7 & 8 on SCCM 2007 USMT Release State Store Error 0X00004005
  • phenorhapsody on Installing a Loopback Adapter in Windows Server 2008 R2
  • Lawrence on Problems Uninstalling WSUS 3.0 (Error 1603)

Archives

  • March 2018
  • January 2018
  • December 2017
  • September 2013
  • July 2013
  • February 2013
  • December 2012
  • August 2012
  • June 2012
  • May 2012

Categories

  • Hyper-V
  • Javascript
  • Lessons Learned
  • Linux
  • Mac OS X
  • Microsoft
  • Networking
  • PowerShell
  • SAN
  • SCCM
  • Security
  • System Administration
  • Virtualization
  • Windows 7
  • Windows Server
  • WSUS

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
  • Home
  • Photography
  • About

Designed by LTheme.com - Powered by Wordpress