header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
configuring iTunes path change with Powershell
Last Post 27 Nov 2009 09:05 AM by halr9000. 4 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
TomUser is Offline
New Member
New Member
Posts:1
Avatar

--
27 Nov 2009 08:35 AM
    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 Shaw (MVP)User is Offline
    Veteran Member
    Veteran Member
    Posts:1641
    Avatar

    --
    27 Nov 2009 08:52 AM
    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:565
    Avatar

    --
    27 Nov 2009 09:01 AM
    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...3265.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:565
    Avatar

    --
    27 Nov 2009 09:03 AM
    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:565
    Avatar

    --
    27 Nov 2009 09:05 AM
    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.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer