Sitecore PowerShell – Practical Scripts, Part 1

powershell

I have been working a lot lately with the Sitecore PowerShell module. Our site is international and therefore we need to support lots of different languages, and the PowerShell module is an invaluable tool in maintaining content across cultures.

There are lots of great resources available to learn more about the module.
Here I am going to start compiling a repository of (hopefully) useful, practical scripts that you can borrow, steal, and learn from. Here we go…

Quick syntax note: in most of the examples below, I use the following syntax for selecting items:

Get-Item -Path "master:/sitecore/content/Home/About Us"

Technically, the “/sitecore” part is not necessary – PowerShell assumes that part. But when copy/pasting out of Sitecore, I’ve found it’s a lot easier to just paste in the entire path rather than go back and remove that one little piece. It really doesn’t matter. Of course you can also use the -ID for selecting, but again, I’m so used to just copy/pasting the path that it’s just easier for me. Do what you like 🙂

Adding Item Languages

These are probably the most-used scripts in my arsenal. We are forever needing to copy/create new language versions for items and child items.
(NOTE: we don’t use language fallbacks much, mostly for compliance and legal reasons, and because they have caused us too many headaches in the past. Therefore managing separate versions for each language/country is an essential and time-consuming task. These scripts help.)

Add Item Language – Single Item

As the title suggests, this simply takes a single item and creates new language versions of that item, copied from a single version. The “-Language” value is the one we’re copying from, and the “-TargetLanguage” is the list we’re copying to. The “-TargetLanguage” value can be a list or a single string.

Get-Item -Path "master:/sitecore/content/Home/About Us" | 
    Add-ItemLanguage -Language "en-US" -TargetLanguage @("en-CA","fr-CA","de-DE") -IfExist Skip

Add Item Language – Child Items

Same as above, but this time we’re creating new language versions for all child items of an item. Very helpful for bulk operations like setting up a new country/language.
NOTE: this does NOT copy the parent item, so if you’re doing bulk operations, don’t forget the parent!

Get-ChildItem "master:/sitecore/content/Home/About Us" -Recurse | 
    Add-ItemLanguage -Language "en-US" -TargetLanguage @("en-CA","fr-CA","de-DE") -IfExist Skip

Updating Fields

Like language fallbacks, we don’t use shared fields all that much either – there are always exceptions for a handful of countries that make shared fields an impossibility. So often we need to update field values across multiple language versions. Here are some useful update scripts:

Set String/Text Value

Updates a single text value.
Another syntax note: as in most programming languages, there are many ways to write a particular script. The “foreach” loop makes the most sense to my C# brain, so that is the syntax I use most often. If you want to experiment with other ways, go for it.

# get all child "Product Item" templates, all languages
$itemList = Get-ChildItem -Path "master:/sitecore/content/Home/Products" -Language * -Recurse | 
    Where-Object { $_.TemplateName -eq "Product Item" }
    
foreach ($item in $itemList)
{
    # check to make sure we need to update the field
    if ($item."Product Type" -ne "widget")
    {
        $item.Editing.BeginEdit()
        $item."Product Type" = "widget"
        $item.Editing.EndEdit()
    }
}

Set Boolean Value

Updates a single boolean/checkbox value.

# get single item, all languages
$items = Get-Item -Path "master:/sitecore/content/Home/Products" -Language *
foreach ($item in $items)
{
    # set Right Align Text to true/checked
    $item."Right Align Text" = [int]1
    # set Full Screen to false/unchecked
    $item."Full Screen" = [int]0
}

Set Workflow Values

Updates workflow fields for a specific media item

# get the Sitecore IDs for the workflow and the approved status
$workflow = "{1B497ED4-6132-4BDF-8AB8-07890AF0DF8A}"
$approved = "{5E50B26D-6344-4167-9CFD-9C7898458EE3}"

# get all child items, ignoring media folders
$items = Get-ChildItem -Path "master:/media library/widget images" -Language * -Recurse | 
    Where-Object { $_.TemplateName -ne "Media folder" }
$items.Editing.BeginEdit()
foreach ($item in $items)
{
    # set all workflow fields as needed
    $item.__Workflow = $workflow
    $item."__Workflow state" = $approved
    $item.__Lock = ""
    $item."__Default workflow" = $workflow
}
$items.Editing.EndEdit()

So that’s it for Part 1. There are lots more to come, so stay tuned.

Advertisements

Shorty and Ebert – A Tribute to Roger Ebert and Chutney Soca

Roger Ebert

I used to listen to Howard Stern a lot and always enjoyed when Roger Ebert would make an appearance on the show. My favorite appearance of his was soon after Stern had moved to satellite radio (this would have been around 2006-2007), when Howard and his staff would take every opportunity to crow about how great things were now that they were on satellite. So when Ebert came on the air, and congratulated Howard on his new gig, they proceeded to go on and on about how great it was, how great the other stations were, etc. Gary even got in on it and started bragging about the music selections on satellite, which led to one of my favorite exchanges:

Gary: “There are stations for every kind of music! Here, watch – Roger, what’s your favorite kind of music?”

Ebert: “Chutney Soca!”

[silence]

Gary (utterly deflated): “Well, OK, I don’t think there’s a Chutney Soca station.”

This exchange was so memorable not only because it was so funny, but also because Ebert had stumped me. I take great pride in knowing a lot about music, and at the time I had never even heard the term “Chutney Soca”, let alone heard any of the music. I was intrigued, and that has stuck with me ever since.

Roger Ebert passed away on April 4, 2013. It was a very sad day for me not only because I so enjoyed his movie reviews, but also because it was his writing that inspired me to write about music on this website. I’ve been trying to come up with some sort of fitting tribute for the past weeks, even though nothing I could do or say could really qualify. It was my wife who finally suggested, “Why don’t you actually learn something about Chutney Soca, and write about it?” Damn, wish I’d thought of that.

So here we are. Now let me say, I am very, very far from being any kind of expert on Chutney Soca. I have listened to it and studied it for mere days. It is really not fair to the music for me to write this so soon, but I felt I needed to get this down while the feeling is still fresh.

Knowing nothing about Chutney Soca, I figured I’d start with a basic Wikipedia primer. It tells us that Chutney Soca is “a crossover style of music incorporating Soca elements and Hindi-English lyrics, Chutney music, with Indian instruments like the dholak and dhantal. It is distinguished from regular soca music by the referencing of rum, alcoholism, infidelity and suicide in the lyrics.” Sheesh. What a definition. Sounds so heavy. And boring. Let’s see if we can do better.

I went to high school with a guy who was originally from Trinidad. I remember having a conversation with him one day about the music he grew up with. He was trying to explain to me and a few other guys about Calypso. The other guys just had blank stares. I thought I was Joe Cool and piped up, “Yeah, like Harry Belafonte, right?” Um, not exactly. I remember him shaking his head, and getting frustrated trying to explain it to us, the uninitiated. “You just have to hear it for yourself,” he kept saying.

He was right, of course. Chutney Soca, like Calypso and so many other forms of music, is an immense melting pot of influences, so much so that it’s sometimes tough to get a handle on. Inevitably any description of Chutney Soca quickly unravels into an endless list of other influential forms. For instance, when I listen I hear elements of jazz (complex polyrhythms and vocal improvisations), 70’s disco/funk (dig the funky rhythm guitar, even with a wah from time to time), hip hop (much more in the beats of modern Soca music, but it’s there in the old stuff too if you listen), raga (the hypnotic Indian rhythms are prevalent), gospel (vocals), ska (the sharp brass hits), reggae (in the vocal rhythms and the guitar ostinatos), and South African Mbaqanga (the interplay between the percussion and harmonic instruments like keys and guitar). And that’s just from my limited knowledge of Caribbean music in general – I’m sure someone schooled in all the various forms would have a field day.

So how do you explain a musical form that encompasses all that??? Well, you pretty much just have to hear it. But I will say this – more than anything, this is dance music. It is designed to get the listener moving. Anyone who has listened to Indian percussion music will immediately recognize the driving, relentless rhythms at play here. This is not passive music – it is active, in your face, “get your ass up and move” music.

Moving forward in my study, I wanted to start at or near the beginning, where Chutney Soca began, with the foundational artists who created this amalgam of Indian and Caribbean sounds. Wikipedia also tells us that the Godfather of Chutney Soca is Garfield Blackman, aka Lord Shorty. So I sought him out, and came upon his 1978 album Soca Explosion.

Over the course of several nights I listened to this album, along with several others both classic and new. Here are some of my impressions of a few songs…

“Higher World of Music” – check out the syncopated rhythms of the guitar playing off the percussion during the vocal breaks. And the Flamenco-inspired Phrygian chord changes and horn lines. I can almost hear Paco de Lucia jamming on this tune. The Flamenco connection actually makes sense when you think that Flamenco originated with the Romani culture in Spain, whose origins can be traced back to India.

“Keep In Touch” – you can really hear the reggae/gospel influences in this one (“Jah, oh Lord, can you hear me people?”).

“Om Shanti Om” – the Indian influences are obvious in this one, not only in the title and lyrics, but also in the percussion and vocal rhythms.

“Soca Fever” – my favorite tune on the album. This one has it all. The infectious driving rhythms, the evocative chord changes, the vocal gymnastics, the rich brass counter melodies. This one just moves. But it also has so much going on melodically and harmonically that it never gets boring or tedious.

Yet, other songs sometimes do. I can definitely say that I have a tremendous new appreciation for this music, however ultimately I can’t quite say that I’m a fan, at least not yet. I loved examining the DNA of Chutney Soca, and I enjoy many aspects of the music, but overall, well, it’s just not my thing. At this point I still don’t feel any emotional connection with the music the same way I do with, say, jazz or rock or the blues. But even that isn’t really fair, because I don’t enjoy ALL jazz, or ALL rock…a lot of it is awful. I guess the best way to say it is that I have a lot more listening to do. And that’s OK. That’s what is so great about the world of music – it is so vast, there is more than enough for everyone.

Before I wrap up, an honorable mention must go to the undisputed queen of Chutney Soca, Drupatee Ramgoonai. Her song “Mr Bissessar (Roll Up de Tassa)”, usually referred to as simply “Roll Up de Tassa”, was another groundbreaking hit and one I listened to over and over again while studying. She deserves much more attention than I’m able to provide here. Go check her out, she’s bad.

In the end, I hope my sojourn into the world of Chutney Soca turned out to be a kind of fitting tribute to Roger Ebert. Preparing for and writing this essay took me way out of my comfort zone and forced me to really think about an art form I (still) know so little about. And I realized, that’s what Ebert’s movie reviews did for me. Reading his reviews led me to discover some of my favorite movies, many of which I never would have seen or sought out had I not read an enthusiastic review on his website. Movies like My Neighbor Totoro and Spirited Away (and all of Miyazaki’s works, for that matter), Hoop Dreams, Some Like it Hot, Fitzcarraldo, A Town Called Panic, and The Third Man come to mind. I hope someday maybe I can do the same for someone else.

(here’s a YouTube link to the entire Soca Explosion album: http://www.youtube.com/watch?v=C1d5uCZCZg8&playnext=1&list=PL0F05F0FC9911D4CD&feature=results_main)

Great Albums: Beyond the Missouri Sky (Short Stories)

Album: 

Beyond the Missouri Sky (Short Stories)

Personnel: Charlie Haden (bass), Pat Metheny (guitars and other instruments)

When I lived in Washington, D.C. there was a radio show on Sunday mornings called “G-Strings” which featured acoustic music played on stringed instruments. The music was usually jazz or classical, with a bit of bluegrass and folk music thrown in. It was a great show and you could always hear some really interesting stuff. The beauty of acoustic music and acoustic instruments is that you can really hear the personality of both the instrument and the player coming through the music.

Beyond the Missouri Sky is an album that, like Haden and Metheny themselves, defies categorization. Both of the players are known as jazz musicians, but this is not really a jazz album, even though it is informed by the spirit of jazz and has many improvised passages. At heart it is a duet album, with Haden on upright bass and Metheny on various acoustic guitars, with a little bit of very subtle supplementation via keyboards, additional guitars (electric, acoustic, and sitar), and percussion. In the liner notes to the album, Haden refers to Metheny’s sound as “contemporary impressionistic americana”. I can’t really say it better than that. But it’s interesting to see that word, “impressionistic”, coming from Haden, who known primarily as a lyrical and, well, impressionistic bassist. My friend Rick  used to always refer to Haden’s playing not as “playing” but as “painting”. It’s really a powerful metaphor when you think about it, especially when listening to this album – you can almost picture the two of them, Haden and Metheny, seated together, painting with their instruments, the wide open Missouri sky as their canvas.

But enough waxing poetic. Back to the music. One little detail that I love about Missouri Sky is that you can hear all the little noises that the instruments make. It’s not sanitized – this is pure musical creation, in all its imperfect glory. Bass strings flap and buzz against the fretboard; guitar strings squeak and creak as the player’s hands slide across the ridged surface of the strings. And the most glorious thing about stringed instruments, especially those played with the fingers, such as guitars and basses, is that more than any other instruments, they respond so well to touch (the master of touch, Jeff Beck, doesn’t play with a pick anymore for a reason). Couple that with a wide dynamic range, and you have an incredibly expressive vehicle.

Missouri Sky is the first album where I really “got” Pat Metheny as an artist, and it’s also when I fell in love with his playing. That may seem strange, considering how prolific he is, but it took me a while to get my head around what was going on in records like Bright Size Life, Watercolors, 80/81, and the like. Missouri Sky is quiet, it’s slower, and provides easier access to the music, and after listening to it – many, many times – I found that it eased the transition into Metheny’s more famous trio records, and beyond.

I won’t talk about every tune here, but I do need to touch on a few of the highlights.

“Our Spanish Love Song” is by far the best piece on the album, and it features one of the best guitar solos I’ve ever heard – possibly THE best. No joke. I would love to know how many takes of this they recorded, and how much they rehearsed it. The song itself was penned by Haden, and has a beautiful melody, the kind that you just want to listen to over and over again. But Metheny’s solo is something to behold. It is almost classical in its composition, utilizing many classical compositional techniques, yet it retains the presence and magic of the best of Metheny’s improvisations. Listen to the way he uses theme and development (around 1:40 – 1:50), and repetition (2:05 – 2:17) to create tension and release.

The playing here is highly technical – his phrases are almost textbook perfect examples of playing over changes, moving only the notes you have to to create that sort of slippery feeling of playing through the chords. My favorite lick in the solo is a great example of this – it’s just a quick turnaround lick that starts at around 2:04. Notice how he outlines the changes perfectly, yet still manages to sound musical, amping the emotion at the same time. Brilliant.

After the solo, the melody is restated before a final rideout solo. This song also features one of my favorite songwriting techniques – stating the melody first in a lower register, then later returning to the same melody an octave higher. You can hear this technique in just about any style of music, and it always works to give the song a sense of movement and momentum, that one extra push at the end to make the song really fly.

“Precious Jewel” hearkens back a bit to Metheny’s “Two Folk Songs” from the 80/81 album. This one has Metheny in strumming mode while Haden handles the melody. It’s a nice break from the more pensive moods of the other tunes. Some obvious overdubbing here, with Metheny playing some electric guitar lines for the melody and solo.

“The Moon is a Harsh Mistress” is probably my second favorite tune on the album, which is kind of amazing considering it’s composed of a very simple melody over some basic open chords (G, D, Am, Em). It’s a tribute to both the songwriting (it was written by Jimmy Webb) and to the setting. The song has been performed and recorded a bunch of times by numerous artists (Joan Baez, Linda Ronstadt, Joe Cocker, and Webb himself), but none come close the emotion that is discovered here…

OK, quick aside/brainstorm…as I was writing this I was thinking that I kinda liked the Linda Ronstadt version and that it reminded me a bit of Grace Potter…then I thought, wow, Grace Potter would absolutely KILL singing this song…then I thought what if Metheny was on guitar and Haden was on bass with Grace Potter singing…then I sat here and daydreamed happily for a while about what that would sound like. Somebody needs to get that together NOW…ok, I’m done.

In this intimate setting the song takes on an intense melancholy tone that is hard to shake off – it stays with you long after the last chord has been played, and you don’t want it to end. The song features some really nice and subtle key modulations as well – if you’re not paying attention you almost miss them completely.

The final song, “Spiritual”, was written by Haden’s son, and you can really hear Haden get into it on this one. The playing by both Metheny and Haden is almost painful in its restraint.

The word I keep coming back to when I think of this album is intimacy. The music here feels close, palpable. Haden and Metheny are true legends and masters of their instruments, yet they never show off, never overplay. Every note is perfectly placed yet they retain a loose, improvisational feel. I listen to at least some of this album almost every day. It has long held a spot on my personal “Desert Island” list, and I think it always will.

Great Songs: The Christmas Song

Song written by: Mel Tormé and Bob Wells

Song performed by: Nat “King” Cole, and everyone else

When I was about 15 or 16 years old my parents took me out one night to a place called Anton’s in Washington D.C. It was a very fancy, upscale restaurant and jazz lounge. We were going to see Mel Tormé. This may sound a bit odd, as if they were dragging me there because they wanted to go but had no regard for me, but no. It was pretty much for me.

At the time I had been taking guitar lessons for about a year, and was just learning about jazz from my guitar teacher. I basically knew nothing about nothing when it came to jazz, but I knew just enough to appreciate what was going on. These days, of course, I know enough to realize what a privilege it was to be able to see Mel Tormé perform, especially in an intimate setting like that. And of course I am old enough to realize what great parents I have for them to do that for me.

Alas, I don’t remember many details about the show, to be honest. I remember Tormé doing a sort of tribute to Ella Fitzgerald that featured a bunch of scat singing, which I usually can’t stand, but hearing him do it I didn’t mind so much – I’d even go so far as to say I really enjoyed it. Maybe it was the quality of his voice – the velvet fog, you know. I remember Tormé’s piano player was a motherfucker (jazz-speak translation: “a really good musician”). I remember the crowd calling out tunes, most of which I didn’t know (I only knew a handful of jazz tunes at that point). Tormé picked one of them and started singing, only to be stopped by the band – they didn’t know the tune. So he kept right on singing, calling out chord changes as he went. I remember being amazed by this and learning later that he had perfect pitch.

And I remember him playing “The Christmas Song”. Actually I recall that he didn’t really seem all that keen to play it. The owner of the club handed him a note about 2/3 through the set. Tormé read it to the audience: “If you think you’re getting off that stage tonight without playing The Christmas Song then you’re out of your mind and I’m not paying you.” It may have been a gag for the crowd, who knows. But he launched into it, a somewhat loose rendition, changing a few of the lyrics just for fun (“Yuletide carols being sung by a choir/And thoughts of girls ripping off my clothes…”).

As great as Tormé was, his is not the best recording of this song. That distinction of course goes to the original version performed by Nat “King” Cole (there were actually two “original” recordings – the first without strings, the second with. The second is the one that became a huge hit). I remember an interview I saw with Tormé where he said after he wrote the song, he knew it could only be sung by Nat. Who knows whether it was his decision or not, but whoever decided it, I’m glad they did. It’s such an iconic, singular performance that whenever I hear “The Christmas Song” performed by anyone else, no matter how great, it just doesn’t sound right. It’s not just his super smooth voice, but also his phrasing. Listen to it and check out how he alternates between hanging back behind the beat, and being right on top of it. He really makes it swing.

“The Christmas Song” was the first song that ever made me think, really think, about songwriting. I’ve known the song since childhood, of course – everybody has. But it wasn’t until those teenage years that I learned that Tormé had written it (along with Bob Wells).The story of its writing is a great little tale – Tormé and Wells sitting by the pool in summer, thinking up wintry things to try to keep cool. But it wasn’t the story that made me pause and think – it was just the simple fact that someone, anyone, had actually sat down and written this song. I’d never thought of songs that way before. This one in particular seemed like it had just always, well, been there, part of the fabric of time and nature and universal experience. But no, someone created it, out of nothing. And it was that thought, that a person (or persons) could create something so meaningful and lasting, that stuck with me. It was an incredibly powerful idea, one that changed the way I thought about and listened to music for the rest of my life.

In the end what this song stirs in me most is gratitude. I am grateful for this song, for its timeless beauty, and for the memories I associate with it. I am grateful that I was able to see Mel Tormé while he was alive and still in great form, and I am grateful that my mom and dad had the understanding to take me there.

Happy Holidays everyone.

Great Solos: Omar Hakim on “I Burn For You”

Song: I Burn For You

Solo performed by: Omar Hakim

From the movie Bring On the Night

Drum solos are tricky things. In rock music, they tend to be geared toward an audience that just wants to scream and hold up lighters/cell phones, which usually translates to drummers playing really loud and/or really fast. They are almost non-existent in pop music. In jazz, drum solos are common. They are usually very intricate, but often sail over the heads of the audience, occupying a space just above the bass solo in the hearts and minds of the listener.

In most cases, alas, drum solos are performed unaccompanied. I hate unaccompanied solos.

The trouble with unaccompanied solos is, in the absence of any harmony or melody to play off of, the solos tend to veer toward extreme displays of technical ability. This is true of all instruments, but especially drums. It is rarely impressive, and almost never any fun. After a few seconds, it’s obvious what level of technique the player is at, and from there it gets boring real fast. The exceptions are usually in those players that are so technically gifted that it boils down to spectacle, a “holy shit how does he/she do that” kind of awe. Dennis Chambers comes to mind; Steve Smith and Victor Wooten too. But even then, after a few minutes I always find myself just wanting to hear some music.

So how to combat this and transform an unaccompanied solo into a musical moment? One word: ostinato.

An ostinato is a musical phrase or riff that is repeated over and over, creating a sort of musical “bed” over which additional rhythms and melodies can be layered. The ostinato can often create a hypnotic effect, and sets the mood for the soloist. Anything can be an ostinato – a simple bass line, a vocal phrase, a piano or guitar chord sequence.

Thankfully, Sting is a thoughtful musician with a tremendous ear for melodic sensibilities. He gets extra credit here for setting up the structure of this arrangement to give maximum emphasis on the music and the musicians. Sting always plays with the best musicians around and he always finds ways to spotlight them, to highlight their strengths. And the bass/vocal ostinato is key to this song’s success.

On its own, “I Burn For You” is a nice song with a cool, mysterious, almost vengeful tone. But in this performance it is elevated to greatness by two masterful solos – the first by Branford Marsalis, and the second by Omar Hakim.

This essay is specifically about Omar Hakim’s drum solo, but I would be remiss if I did not acknowledge the beautiful soprano sax solo that Marsalis plays leading up to Hakim’s tour de force.

Branford’s solo is an excellent example of both tension/release as well as theme/development. Using short bursts of three- and five-note clusters, Marsalis gradually ratchets up the tension by playing angular polyrhythms and wonderful harmonically dissonant scalar passages over the solid groove set up by Hakim and bassist Darryl Jones (Sting plays guitar on this one, then switches to “Brian” the upright bass during the ostinato section), punctuated with impossibly long sustained cries.  Hakim’s drumming under Marsalis builds as well, until Branford drops back down and let’s Hakim take over. And that’s where things really take off.

Now, I’m not a drummer, and I know almost nothing about the technical aspects of drumming beyond the basics. But listening to and watching this solo quickly modulates from an intellectual to a visceral emotional experience. What I love most about this solo – well, both solos really – is that it begins by lighting up the technical side of my brain, with Branford’s beautifully dissonant melodies and rhythms playing against the groove set up by Hakim and Jones, and then it morphs into such a pounding, hypnotic, emotional experience that just washes over me and leaves me wanting to start primal screaming.

The solo is crafted beautifully, with a perfect attention to dynamics. As the solo proceeds, the tension and emotion builds to an impossible crescendo, ready to burst. Hakim ends it at the perfect moment, with a cathartic barrage of triplet snare hits, leaving us delirious and wanting so much more.

Have I seen and heard more technically impressive drum solos? Certainly. So why does this solo in particular affect me so much? I think it’s because every time I listen to it I am struck by how musical it is. For me, Max Roach was always the most musical drum soloist around, and I think in Hakim’s solo I hear the next evolution of his approach. It’s not just a show off moment – it’s a complete part of the song. I’ve always said a great solo can elevate a good song up to a great song, and this solo is the perfect example of that. This is one of the great solos, and also one of the great moments in music.