Search code examples
powershellitunespowershell-2.0ipod

Copying music to an Ipod


I would like to know if there is a way to copy music to an ipod using powershell .

I don’t mind having to install itunes on my pc if it is needed. I don’t not want to sync my ipod with itunes though or add the files to the itunes library .

The way I copy music now is that I just select the folder with music I want and drag it on to my ipod in itunes. That way it does not add the music to the itunes library .


Solution

  • I managed to figure it out

    $IpodName = "type the name of your ipod hear as it apears in itunes"
    $SongToCopy = 'c:\tools\test\04.mp3'
    
    #Create a com object to talk to Itunes and List the Librarys
        $iTunes = New-Object -ComObject iTunes.Application
        $LibrarySource = $iTunes.sources
    
    $IpodSource = $LibrarySource.ItemByName($IpodName)
    
    $IpodPlaylists = $IpodSource.Playlists
    $IpodPlaylist  = $IpodPlaylists.ItemByName($IpodName)
    $IpodTracks    = $IpodPlaylist.Tracks
    
    $IpodTracks.Count
    
    $IpodPlaylist.AddFile($SongToCopy)
    
    $IpodTracks.Count