header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

We have a new sponsor!  Introducting Pragma Systems.  See the home page for details.

configuring iTunes path change with Powershell
Last Post 27 Nov 2009 05:05 PM by halr9000. 4 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
sconkersUser is Offline
New Member
New Member
Posts:1
Avatar

--
27 Nov 2009 04:35 PM  
I need to move a centrally stored music repository from one server to another. This is accessed by about 30 clients within a music company. So I need to change the file path at the back end of iTunes configuration.

Spoke to Apple about this. They of course do not support programmatic change of their products on Windows machines whatsoever. Their only resolution was to do it manually through EDIT > PREFERENCES > ADVANCED > CHANGE 'iTunes Media folder location' on each client.

I am a bit new to Powershell, so hoping someone can point me in right direction. I'm just not sure how I can get into iTunes configuration using Powershell. Any help would be gratefully received.

Many thanks,
Tom
marco.shawUser is Offline
Site Moderator
Advanced Member
Advanced Member
Posts:593
Avatar

--
27 Nov 2009 04:52 PM  
Well, the only approach I can think of is looking whether this entry is stored in registry... Remote registry editing can be tricky though.
Marco

*Microsoft MVP - Windows PowerShell
https://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
*Blog - http://marcoshaw.blogspot.com
halr9000User is Offline
PowerShell MVP, Site Admin
Advanced Member
Advanced Member
Posts:524
Avatar

--
27 Nov 2009 05:01 PM  
Found it, but I don't have time to write a solution. Luckily, I'm not the only person here. :)

1. look at $env:appdata\Apple Computer\iTunes or maybe $env:appdata\Roaming\Apple Computer\iTunes and check out iTunesPrefs.xml
2. Figure out how to go to the right place in the XML file and assign the contents of a certain node to a variable. This worked for me:

PS > $prefs = "$env:appdata\Apple Computer\iTunes\iTunesPrefs.xml"
PS > [xml]$xml = gc $prefs
PS > $xml.plist[1].dict.dict[2].data[7]

QwA6AFwAVQBzAGUAcgBzAFwASABhAGwAXABNAHUAcwBpAGMAXABpAFQAdQBu
AGUAcwBcAGkAVAB1AG4AZQBzACAATQB1AHMAaQBjACAATABpAGIAcgBhAHIA
eQAuAHgAbQBsAA==

I made an educated guess that this was the right key, and that it was base64-encoded. I manually stripped the spaces and so forth and...

PS > $str = "QwA6AFwAVQBzAGUAcgBzAFwASABhAGwAXABNAHUAcwBpAGMAXABpAFQAdQBuAGUAcwBcAGkAVAB1AG4AZQBzACA
ATQB1AHMAaQBjACAATABpAGIAcgBhAHIAeQAuAHgAbQBsAA=="
PS > $b = [convert]::FromBase64String($str)
PS > [system.Text.Encoding]::Unicode.GetString($b)
C:\Users\Hal\Music\iTunes\iTunes Music Library.xml

Instructions on how to do the base-64 encoding/decoding are here: http://blogs.msdn.com/powershell/ar...83265.aspx.

Then put the right value in the file, and cross your fingers, and restart iTunes. :)
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast
Author, TechProsaic
halr9000User is Offline
PowerShell MVP, Site Admin
Advanced Member
Advanced Member
Posts:524
Avatar

--
27 Nov 2009 05:03 PM  
I did check the registry first, Apple doesn't put many things in the registry for their Windows software.
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast
Author, TechProsaic
halr9000User is Offline
PowerShell MVP, Site Admin
Advanced Member
Advanced Member
Posts:524
Avatar

--
27 Nov 2009 05:05 PM  
In case you are curious, the magical XML query was a bunch of experimentation combined with noticing that the name of a config item has the same index as its data.

$xml.plist[1].dict.dict[2].data[7]
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast
Author, TechProsaic
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 footer
footer