Powershell scripts for itunes
howdy y'all,
i've recently been learning windows powershell. it's part of every win7 install and i think it's included in vista. for xp, you hafta download it from ms.
anyway, i have a script or two that i was playing with and wondered if someone else was interested the same. perhaps someone who really understands programming could improve my amateur coding. (grin)
the next post has the 1st script.
take care,
lee
howdy y'all,
this one updates song ratings ...
IF
- rating is zero
-- AND playedcount is greater than or equal to playedcount threshold
OR
- rating is zero
-- AND skippedcount is greater than or equal to skippedcount threshold
-- AND playedcount less than playedcount threshold
i figure that if i've skipped a song more often than i have played it and i've skipped it at least a certain number of times, then i pro'ly don't care too much for it. (grin)
since i can't find a way to correctly post CODE, i posted a link to the stored file. that's here ...
http://dl.dropbox.com/u/5952017/Itunes_Set-Default-Rating.ps1
there is a lot of extra stuff in there that can be removed. the "save log file to system temp folder" and the "what's happening now" stuff, for instance.
other than the purely feedback-oriented, yes-something-really-is-happening stuff, can you see a way to make it work better?
take care,
lee
Similar Messages
-
Powershell script for security groups and users for multiple share folders
Hi scripting team,
I need your help with powershell script for the below queries
1. List out the security groups for more than one server share path and output it to a file ( csv )
For eg.
If the are are two share paths
\\servername\foldermain\folder1
\\servername\foldermain\folder2
So I needs the list of security groups for each share path
And the output needs to be under each any every path.
2. Grab the users belongs to main security groups and it nested groups for more than one security group and listed the users under each and every group. No need to display nested groups. Just users belongs to main group and users under nested.
Your teams help is much appreciated
Thank you.
Thilochana kumararatneHi Braham,
Thanks for your quick reply.
Are we able to do this on two stage method
1. grab the security groups from the share paths
if can grab the share path from a separate txt file than copying it to the <your path> location
so i can modify the txt file
once run the script
if can the output like below to a CSV file
\\servername\foldermain\folder1group 1group 2group 3\\servername\foldermain\folder2group 1group 2group 3then i know which groups belongs to which share paththen i can remove the duplicate groups and keep the common groups to grab the users belongs to itso with the second script same as the first copy the security groups to a txt file and the out put as below.what I needs is the users full name and the samaccount name ( user id )group 1user1user2user3
group 2user1user2user3looking forward your help on thisThank you.Thilo -
Hi,
I have a text file in which some SamAccountNames are present.I need to check the file while creating a new users through ADUC console.If a username that is going to create through ADUC console is present in the file, then it should prompt a message
that the user is already present in the text file.
Is there any possibility of contacting the powershell script from the ADUC console.If so, then while creating a new user through ADUC console, what is the proceedure for executing that powershell script.
please provide me the approriate solutions.
Thanks
Prasanthi kRun the below Powershell Script for users are exist or not in AD. Later you can create the users.
#Find Users exist in AD or Not?
#Biswajit Biswas
$users = get-content c:\users.txt
foreach ($user in $users) {
$User = Get-ADUser -Filter {(samaccountname -eq $user)}
If ($user -eq $Null) {"User does not exist in AD ($user)" }
Else {"User found in AD ($user)"}
Active Directory Users attributes-Powershell
http://gallery.technet.microsoft.com/scriptcenter/Getting-Users-ALL-7417b71d
Regards~Biswajit
Disclaimer: This posting is provided & with no warranties or guarantees and confers no rights.
MCP 2003,MCSA 2003, MCSA:M 2003, CCNA, MCTS, Enterprise Admin
MY BLOG
Domain Controllers inventory-Quest Powershell
Generate Report for Bulk Servers-LastBootUpTime,SerialNumber,InstallDate
Generate a Report for installed Hotfix for Bulk Servers -
Trying to create a script for iTunes
This is one of those questions that probably has a very simple answer unless you haven't worked with Automator or applescripts.
I found Automator, created a script for iTunes to change settings for audiobooks that I import from CD so that it remembers it's place in a "song", makes it so that it doesn't show up in shuffle lists, and doesn't have a gap between songs. Yippee for me.
I click on File, Save, name the file and save it and ... it doesn't show up under iTunes. It only took me 45 minutes to get it so that the scroll icon shows up under iTunes (I'm so confused now that I don't even know which thing I did caused that to happen) but my script I created doesn't show up.
I did find one place that said to place the file in (myname\library\scripts\programname) So I went to my home folder, find the library folder, found the scripts folder, and found only one application under there (Safari) but no iTunes. I created a folder called iTunes and saved my script there but ... it doesn't show up under iTunes.
I did try quitting iTunes and opening it back up and ... it still isn't there.
Is this even the right place to ask this question?OlsonBW wrote:
........Is this even the right place to ask this question?
If it's not, then may I recommend MacFormat Magazine's own discussions forum -
http://forum.macformat.co.uk/login.php?redirect=privmsg.php&folder=inbox
I found that this is full of 'Users' and more likely to be experienced using AppleScript and Automator.
Although I don't say that someone here won't be able to help. Just might take longer here or, as you yourself suggest, may need posting elsewhere on this site. Just speaking from previous experience of both sites -
Using Echo Command in PowerShell Script for Configuration Item
Hello All,
Before you tell me to post my PowerShell question to the PowerShell Forum, please know that the PowerShell portion of my task works just fine. It is the SCCM portion of my task that keeps failing, so that is why I am here. To give some background...
There are two servers in our SCCM test environment. Both the SCCM server and SQL DB server are 2012, patched and updated.
Test servers in my Device Collection being used for running Baselines and Reports against are 2008R2 and 2012, patched and updated.
I have created a Configuration Item that checks to see if the FTP Server Role Feature has been installed on a 2008 or 2012 server. To do the check, I am using the following PowerShell script:
(get-windowsfeature -Name Web-Ftp-Server).Installed
When I log into my 2008R2 and 2012 test servers, and run this command directly on the server, it will return a "True" if the FTP Server Role Feature is installed on either server, and a "False" if it is not installed. Basically,
it works as advertised.
When I setup my Configuration Item and then deploy my Baseline, or run a report against my device collection of test servers, SCCM will return a correct response (True or False) for the 2012 test server, but throws the following error for the 2008R2
server:
0x87df00329 application requirement evaluation or detection failed
Google searches for this have not been very helpful.
Now, when I created the Configuration Item and referenced PowerShell, the configuration screen has the following note:
"Specify the script to find and return the value to be assessed for compliance on client devices. Use the echo command to return the script value to Configuration Manager."
Since I did not include an echo command in my PowerShell script above, I figured that was my problem, so I did the following:
Logging onto both of my test servers (2008R2 & 2012) I was able to successfully run the following PowerShell commands and get the expected responses of True or False:
(get-windowsfeature -Name Web-Ftp-Server).Installed | echo
(get-windowsfeature -Name Web-Ftp-Server).Installed | write-output (http://technet.microsoft.com/en-us/library/hh849921.aspx)
(get-windowsfeature -Name Web-Ftp-Server).Installed | write-host (http://technet.microsoft.com/en-us/library/ee177031.aspx)
However, when I use any of these PowerShell commands in my Configuration Item, NEITHER of my test servers returns a response to the SCCM server.
When I check the report, both servers show as "Unknown" and when I click on the number 2 (as in 2 servers unknown), the following report page (List of unknown assets for a configuration baseline) has absolutely no data/information at all.
So...I am at a loss.
SCCM tells me to use an echo command to return a script value to Configuration Manager. The PowerShell scripts above, with the various echo related commands, work just fine on the servers themselves, but they return no information when run via SCCM.
What am I missing?
Any help will be appreciated.
Thanks in advance for your time.Sorry for my ignorance, but I don't understand. (I forgot to mention that I am new at both PowerShell and SCCM.)
After I change the PowerShell script to add the echo/write-output/write-host cmdlet, I open the ConFig Item and "Clear" the PowerShell script and then re-add it. When I do that, it correctly shows the change in the ConFig Item.
Next I open the Baseline, then open the ConFig Item within the Baseline to make sure the change is reflected there as well, which it is.
I then deploy the Baseline to my Device Collection. After that, I run a report against the Baseline and Device Collection and it returns the "Unknown" result.
If I open the PowerShell script and remove the echo/write-output/write-host cmdlet, then go through the rest of the process of updating and reporting, the result it returns changes, showing one server in compliance and the other server out of compliance,
which leads me to think that all changes have taken correctly.
Does that sound right? If I manually deploy the Baseline, is that the same as the client retrieving policies from the management point?
Sorry to be so thick but I'm learning as I go.
Thanks again for your help. -
FIM Reporting ETLScript PowerShell Script for SCSM 2012?
Hi,
The FIM Reporting Deployment Guide is great, however on a few occasions it forgets to mention where you meant to execute things (http://technet.microsoft.com/en-us/library/jj133855(v=ws.10).aspx) .
For example, if it wasn't for the screenshot in the article, we would not have known that we need to run the ETLScript from the FIM Service/Portal server.
Everything until the ETLScript has thus far worked; and we have deployed the Service Manager 2012 console on the FIM Service/Portal server (since we are using SCSM 2012 for FIM Reporting).
However, it appears that the ETLScript (in the deployment guide) has been written for SCSM 2010.
So, has Microsoft or anyone published an updated SCSM 2012 ETLScript script?
Thanks,
SKCould this be it?
http://gallery.technet.microsoft.com/PowerShell-Script-to-Run-a4a2081c -
Powershell script for mailbox permissions
Hello,
Part of my tasks as an Exchange admin is to give access to shared mailboxes. The access usually are:
Send AS
Receive As
Send on Behalf Of
Full mailbox
Is there a powershell script out there that does all of the above?
thanks,
AlexisHi,
Probably not prewritten, but you can check the repository for starters:
http://gallery.technet.microsoft.com/scriptcenter
EDIT: I should mention - this isn't too hard to write, so this could be a good opportunity to learn how to get around in the EMS.
Don't retire TechNet! -
(Don't give up yet - 12,830+ strong and growing) -
Powershell script for deleting sitecollection and its content db
want to know whether any powershell script is avlble for deleting the sitecollection and its content db at oneshot!
i have created sitecollection specific content db and i wanna delete the same.Hi,
Below link will help to delete site collection
http://technet.microsoft.com/en-us/library/cc262392(v=office.15).aspx
Thanks
Somnath Matere -
Powershell script for removing some users from a particular Site Collection
Hi,
I am looking for a PowerShell script to delete a few users from a particular Site Collection. I am unable to delete them from/_catalogs/Users/simple.aspx page therefore need some other medium to
delete users from the site collection.
My ultimate aim is to have no user profile with "tp_deleted" field's value as 0 in the USERINFO table. Currently there are about 40 odd users with this field's value as 0 and this is affecting my crawling of this content database.Thanks for the reply Alex & eHaze,
I have a content source of root site which crawls all the site collections under it. Out of the 9 site collections, only 8 are getting crawled and 1 doesn't get crawled at all. The error in the crawl logs is
The SharePoint item being crawled returned an error when requesting data from the web service. ( Error from SharePoint site: Value does not fall within the expected range. )
I tried a lot of things, searched over the net and finally found
this which helped me solve the same issue in my development environment. I deleted these users from userInfo table and ran a full crawl. And the issue was fixed.
Now since I cannot delete the users from userInfo table directly from PROD environment, I used .../_catalogs/Users/simple.aspx list
to delete users from this site collection. While some of the users I could delete, quite a few I could not. Clicking on the profile redirected me to the home page rather than the info page of the profile.
This
is why I have to delete these users from the site collection.
Alex - the link you shared, I guess it is for a web application level.
eHaze - the script you shared throws this error:
Get-SPSite : Cannot find an SPSite object with Id or Url: http://dev-apps/divisions/BT. At C:\PowerShell Scripts\DeleteUserFromSiteCollection1.ps1:4 char:19
+ $site = get-spsite <<<< $siteURL
+ CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletGetSite:
SPCmdletGetSite) [Get-SPSite], SPCmdletPipeBindException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSite
You cannot call a method on a null-valued expression.
At C:\PowerShell Scripts\DeleteUserFromSiteCollection1.ps1:9 char:27
+ $site.SiteUsers.Remove <<<< ($LoginName)
+ CategoryInfo : InvalidOperation: (Remove:String) [], RuntimeExc
eption
+ FullyQualifiedErrorId : InvokeMethodOnNull
hope this info helps. -
can anyone pls point out whats the power shell script for "use this termset for site navigation" in the termstore management tool in my central admin';s manage serv appln-->managed metadata serv appln ->term styore mgmnt tool
i would like to check this "checked" through powershell script
help is appreciated!Hi,
To check if the term set has been set to be used for site navigation, we need to check the
NavigationTermSet.IsNavigationTermSet property for the term set.
Here is the code example for using PowerShell to get the setting:
$site=Get-SPSite "your site collection URL";
$session = Get-SPTaxonomySession -Site "your site collection URL ";
$termStore = $session.TermStores["Managed Metadata Service"];
$Group = $termStore.Groups[“Group Name”];
$TermSet = $Group.TermSets[“Term Set Name”];
$navTermSet = [Microsoft.SharePoint.Publishing.Navigation.NavigationTermSet]::GetAsResolvedByWeb($termset, $site.RootWeb, "GlobalNavigationTaxonomyProvider");
write-host $navTermSet.IsNavigationTermSet
Best regards.
Thanks
Victoria Xia
TechNet Community Support -
SharePoint 2010 Powershell scripting for user profile
Please help to have a powershell script which will provide the details related to user profile service application like:
Number of user profiles:
Number of user properties
Number of Organization properties
Number of Organization profiles
Number of Audiences
Un compiled Audiences
Audience Compilation status
Last compilation time
Synchronization schedule
Santosh sethiHi,
If you're looking for prewritten scripts, you can check these two places:
http://gallery.technet.microsoft.com/scriptcenter
http://get-spscripts.com/
You should read this too:
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/a0def745-4831-4de0-a040-63b63e7be7ae/posting-guidelines?forum=ITCG
Let us know if you have any specific questions.
Don't retire TechNet! -
(Don't give up yet - 12,830+ strong and growing) -
Can anyone spot the error in this script for iTunes?
This AppleScript is designed to copy the Name and Artist of an iTunes track, then populate the Album Artist field with both, separated with an oblique. But when I run the script in iTunes, it only pastes the Artist name in to the Album Artist field and not the whole string.
tell application "iTunes"
if selection is not {} then -- if tracks are selected...
set sel to selection
set numTracks to (length of sel)
set s to "s"
if numTracks is 1 then set s to ""
display dialog "Adds the name of the track and the name of the artist to the Album Artist field." & return & return & (numTracks & " track" & s & " selected.") buttons {"Cancel", "Continue"} default button 2 with title "Create Album Artist" giving up after 30
if gave up of result is true then return
repeat with t from 1 to numTracks
tell contents of item t of sel
set {album artist} to ({get artist} & " / " & {get name})
end tell
end repeat
else
display dialog "No tracks have been selected." buttons {"Cancel"} default button 1 with icon 0 giving up after 30
end if -- no selection
end tellHello
Try -
tell item t of sel
set album artist to (get artist) & " / " & (get name)
end tell
instead of -
tell contents of item t of sel
set {album artist} to ({get artist} & " / " & {get name})
end tell
In your original code, the left and right value of assignment are both list, i.e. -
left value = {album artist}
right value = {get artist, "/", get name}
Consequently 'album artist' is assigned to the 1st item of the list at right, which is the result of 'get artist'.
In order to avoid this, don't use list assingment, which is not necessary at all here.
Also, I think you may just tell item t of sel, not contents of item t of sel.
Hope this may help,
H -
PowerShell script for AD name change
I need to change all users logon name in AD to their first name.last name Server 2003
Here is my suggestion of a PowerShell V1 script to rename all users (sAMAccountName):
# Filter on all users that have givenName and sn assigned.
$searcher=[adsisearcher]'(&(objectCategory=person)(objectClass=user)(givenName=*)(sn=*))'
[void]$searcher.PropertiesToLoad.Add('distinguishedName')
[void]$searcher.PropertiesToLoad.Add('sAMAccountName')
[void]$searcher.PropertiesToLoad.Add('givenName')
[void]$searcher.PropertiesToLoad.Add('sn')
$searcher.PageSize
= 200
$Results =
$searcher.FindAll()
ForEach ($Result
In $Results)
# Retrieve values.
$DN
= $Result.Properties.Item("distinguishedName")
$NTName
= $Result.Properties.Item("sAMAccountName")
$First
= $Result.Properties.Item("givenName")
$Last
= $Result.Properties.Item("sn")
# Construct desired "pre-Windows 2000 logon" name.
$NewName
= "$First.Last"
# Make sure new name 20 characters or less.
If ($NewName.Length
-gt 20)
# I don't know how to trim $First in PowerShell to make $NewName 20 characters.
# Check if name should be updated (case insensitive).
If ($NTName
-ine $NewName)
# Trap possible error.
Trap
"Unable to rename user $DN to $NewName"
"Error description: $_"
Continue
# Bind to user object in AD.
$User
= [ADSI]"LDAP://$DN"
# Assign new name.
$User.sAMAccountName
= $NewName
# Save the change to AD.
$User.SetInfo()
Test first, by commenting out the SetInfo() statement and echo $DN and $NewName for all users. Note that the script could trim $First to limit $First.$Last to 20 characters, but I could not find a way to do this. Also, this script does nothing to prevent
duplicate sAMAccountName values, but the possible error will echo to the screen.
Richard Mueller - MVP Directory Services -
PowerShell Script for Setting the Welcome Page View of a document set
Hi,
We are using document set in the document library and we have created the separate view in the document set and it will show only particular metadata columns. We need to change from default view to another view. For this, we need to write the power shell
script and update the document set welcome page view link in the document set template. Please let me know how we can get this.
Thanks,
MylsamyHey Mylsamy,
welcome page view is stored in $contenttype.XmlDocuments. Here is how you can change the view using powershell:
$web = Get-SPWeb "WEBURL"
$list = $web.Lists["LISTNAME"]
$contenttype = $list.ContentTypes["CONTENTYPENAME"]
$viewid = $list.Views["VIEWNAME"].Id
$xmldocs = $contenttype.XmlDocuments
foreach($xmldoc in $xmldocs)
if($xmldoc.Contains("WelcomePageView"))
Write-Host "XML contains WPV"
$newview = [XML] @"
<wpv:WelcomePageView xmlns:wpv="http://schemas.microsoft.com/office/documentsets/welcomepageview" ViewId="$viewid" />
$xmldocs.Delete("http://schemas.microsoft.com/office/documentsets/welcomepageview")
$xmldocs.Add($newview)
break;
$contenttype.Update($updateChildren, $false)
Write-Host "Welcome Page View updated at " $list.Title
Regards,
Alexander -
Copying script for itunes database files?
Hi,
I stored my itunes music on another internal HD called Spitfire. The default storage folder for the itunes xml and library files is in my main internal HD /user/music/itunes folder ie. Master
i use superduper to backup Spitfire, but i would like to backup the 2 aforementioned files.
is there a script (I'm using panther latest version) to automatcially copy and paste the 2 files from Master to Spitfire?
Cheers,
keeblerTry this:
tell application "Finder"
repeat with this_item in items of folder "path:to:folder"
if modification date of this_item is greater than date "Sunday January 1, 2006 00:00:00" then
set the_alias to this_item as alias
tell application "iTunes"
add alias the_alias
end tell
end if
end repeat
end tell
The path to the folder in line 2 and the date in line 3 can be customized as needed. The path needs to be delimited by colons.
(13381)
Maybe you are looking for
-
Why same query runs on isqlplus but not in Forms/Reports trigger
Hi, I have one query in which I extract one column with parent table join if I run same query on isqlplus prompt it works but if I run same on Forms/Reports trigger it says found "select" where something else expected. below is an example . select em
-
Birthdays in Contacts do not appear in Calender?
If I add a birthday date to a contact, it does not seem to appear in the Calender...? I have searched around and can only find some really old threads discussing this, with various somewhat cumbersome "solutions" like entering dates in Outlook. I'm k
-
How to get notification of target/untarget of application in managed server
through JMX. I need to be informed about target/untarget of application.
-
Hi All, In my project,For various business reasons, we are looking to sett up the stores as plants u2013 meaning that we would follow the STO flow. There are some 500 stores. This would mean that we would either configure 500 plants OR 1 plant with s
-
How "Get Back" Lost Internal ("Macintosh HD") Drive?
I already have a thread on the forum, but I thought I'd start a separate thread to address a very limited, but perplexing, question: After unsuccessfully running Disk Repair from the Installation disc, I "lost" my internal drive (called "Macintosh HD