Looking for help with PowerShell script to delete folders in a Document Library

I'd like to create a PowerShell script to delete old folders in a Document library that are over 30 days old. Has anyone created something like this?
Orange County District Attorney

Hello Sid:
I am trying to do the same and Iam running the script to delete the subfolders inside a folder  but I have some errors. 
Could you please take a look?
_______Script________
$web = Get-SPWeb -Identity https://myportal.mydomain.com
$list = $web.GetList("ar_mailingactivity")
$query =  New-Object Microsoft.SharePoint.SPQuery 
$camlQuery = '<Where><And><Eq><FieldRef Name="ContentType" /><Value Type="Computed">Folder</Value></Eq><Leq><FieldRef Name="Created" /><Value Type="DateTime"><Today OffsetDays="-30" /></Value></Leq></And></Where>'
$query.Query = $camlQuery
$items = $list.GetItems($query)
for ($intIndex = $items.Count - 1; $intIndex -gt -1; $intIndex--)
   $items.Delete($intIndex);
________Errors_______
Unable to index into an object of type System.Management.Automation.PSMethod.
At C:\Script.ps1:2 char:22
+ $list =$webGetList <<<< "ar_mailingactivity"]
+ CategoryInfo
:InvalidOperation: (ar_mailingactivity:String) [], RuntimeException
+ FullyQualifiedErrorID
:CannotIndex
You cannot call a method on  a null-valued expression.
At c:\Script.ps1:6 char:24
+ $items = $list.GetItems <<<< ($query)
+ CategoryInfo
:InvalidOperation: (GetItems:String) [], RuntimeException
+ FullyQualifiedErrorID
:InvokeMethodOnNull

Similar Messages

  • Looking for Help with Hyperion to JAVA

    I am looking for help with connecting Hyperion to Java. We are in Maryland but would be willing to work out something for remote consulting. If you have experience with connecting web services, hyperion, and Java and would be interested in about 80 hours of consulting please contact me at:[email protected] x4846

    Hi,
    From your description, you want to achieve the following goal:
    Configure Exchange to filter the attachments if the size is over 10 MB and store it in a public folder, and then forward the email to Salesforce.
    Based on my knowledge, I'm afraid that it can't be achieved. Exchange can filter messages with attachments, but it couldn't store these attachments on public folder automatically. Also, I don't see any transport rule can do it.
    Hope my clarification is helpful.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Looking for help with respect to configuring MS Exchange server to handle attachments over 10 MB for forwarding to Salesforce (Email-to-case).

    Looking for help with respect to configuring MS Exchange server to handle attachments over 10 MB for forwarding to Salesforce (Email-to-case).
    Problem - SFDC does not create cases from emails that have more than 10 MB of attachments. Our clients will not go-live if their clients cannot send in emails with attachments over 10 MBs
    Potential resolution - Configure MS exchange to strip off the attachments(if over 10 MB) and store it in a public folder, forward the email to Salesforce (so the case gets created or the email
    is associated to an existing case), the client should have some way to know if the attachments were stripped off and should be able to dlownload the attachments and continue with case resolution.
    Any help is appreicated!
    Thanks

    Hi,
    From your description, you want to achieve the following goal:
    Configure Exchange to filter the attachments if the size is over 10 MB and store it in a public folder, and then forward the email to Salesforce.
    Based on my knowledge, I'm afraid that it can't be achieved. Exchange can filter messages with attachments, but it couldn't store these attachments on public folder automatically. Also, I don't see any transport rule can do it.
    Hope my clarification is helpful.
    Best regards,
    Amy Wang
    TechNet Community Support

  • One question I am looking for help with is, when you hit the history button I want my last fifty pages to show up instead of just fifteen. Is it possible to

    one question I am looking for help with is, when you hit the history button I want my last fifty pages to show up instead of just fifteen. Is it possible to change that setting?
    TY

    The History menu can only show that fixed maximum of 15 as that is hard coded.
    Maybe this extension helps:
    *History Submenus Ⅱ: https://addons.mozilla.org/firefox/addon/history-submenus-2/

  • Looking for Help with Active Directory Script to Remove a User from msExchDelegateListLink

    I'm struggling to put together an Active Directory Powershell script that will remove a specific user from the msExchDelegateListLink.
    It looks like Set-AdUser would do the trick. I would want to remove a user in the format of
    {CN=Wood\, Sandy,OU=Networking,OU=IT,DC=my,DC=domain,DC=com}
    Has anyone succeeded in doing this before?
    Orange County District Attorney

    I use this:
    $user = '<user name>'
    $userDN = Get-ADUser $user | select -ExpandProperty DistinguishedName
    $delegates = Get-ADUser $user -Properties msExchDelegateListBL |
    select -ExpandProperty msExchDelegateListBL
    foreach ($delegate in $delegates)
    Set-ADUser $delegate -Remove @{msExchDelegateListLink = "$UserDN"}
    Never quite got around to putting it into a function.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • New Mac user looking for help with Finder, Preview, Keyboard, & Dock

    So about a month ago I switched over from a lifelong Windows user to a brand new MacBook Pro, and while I am adjusting pretty well, there are still some things that I haven't quite figured out.
    First up on the list is Finder! I like my files to be arranged just like how they are in Windows Explorer--folders first alphabetically, then files alphabetically. I've managed to acquire this setting by messing around with the "clean up by" and "arrange by" functions but I don't really know the specific combination. Most of the time these preferences are saved and set as the defaults under "View Options" but every once in a while it resets and I have to tinker around with the settings all over again. Does anyone know of a way to fix this? It's only happened twice so far, but I'd rather not have it happen again. Also, occasionally when I delete an item, there is a blank space left where the icon was instead of all the files following it bumping up a space. Any quick fixes for this bug?
    Next up is Preview. Again, I like the Windows Way and I like to be able to browse between the files in a folder while using Preview/Windows Photo Viewer. I know that there is a way to browse between files if you select the whole folder and stick it in Preview, but is there a way to achieve the same result without having to do that? An app or "extension" of some sort that adds arrows in to browse between photos? I've had no luck finding anything other than the aforementioned option. Is there a good free alternative to Preview that will function similarly with the browse between photos option?
    One of my favorite things about my new Mac is the backlit keyboard function. My old laptop didn't have it and as someone who is online more often at night it is super helpful. But is there a way to turn it off during the day/in bright settings? A way to put it on a timer? In System Preferences I selected the option "Adjust keyboard brightness in low light", which I assumed to mean would have the keyboard NOT very bright when there IS light, but it continues to light up just the same. Any apps or extensions to help with this one?
    And finally, the dock! This question is more about aesthetics than functionality but help is appreciated all the same. Currently, my dock looks like this: http://i42.tinypic.com/35ktxlz.png It is rather opaque and the indicator lights can barely be seen. However, in a lot of tutorial videos I've been watching, many people have docks that look like this: http://i.i.cbsi.com/cnwk.1d/i/tim/2011/07/19/Lion_LaunchPad.png It is a darker shade of gray, the divider is dashed rather than a straight line, and the indicator lights are clearly visible. Does anybody know how to get this look for the dock? I've looked in the dock preferences but there's not really anything in there other than magnification/size/effects.
    That about sums things up! I'm sorry if any of these seem like "silly" questions but they are all things I have been unable to find answers for. Any and all tips, tricks, and help is appreciated! Thanks in advance for all your help!!

    congratulations on coming over from the dark side.
    Seems like you are interested in column view, which would show you the hierarchy of folders and files:  Column View in Mac OS X Mountain Lion - For Dummies Not sure what's going on if your finder settings don't stay put. May be a corrupted preferences file, which is easy to fix, but is perhaps a topic for another discussion.
    What I'd suggest is to have an open mind and try to see what the mac can do, rather than force it to look like your windows machine. I mean, if you just want it to look like windows, then why bother switching? If you give it a little time, you'll start to appreciate the mac way of doing things, and see how it is infinitely more awesome, powerful, creative, intuitive, and better designed (and the software way better written)  than what you left behind. But that's your call.
    There are some threads on this forum with complaints about the backlight. Keyboard backlight settings query...: Apple Support Communities  Evidently it depends on the angle of the screen and the light sensor relative to the light. Some suggest that a SMC reset may help: Intel-based Macs: Resetting the System Management Controller (SMC)  This is not an issue for me, I just adjust the brightness with the keyboard buttons if I want. Real men shift their own gears, drink their coffee black, and adjust their own keyboard brightness. I am not aware of any software to exert more control over this feature but a search of macupdate  Download Apple Mac Software & iPhone Software : MacUpdate may help. I mean, it's up to you what is important. I can waste a lot of time playing around with the GUI and with unnecessary software, or I can just get my work (and play) done.
    You might prefer the no-glass dock, that removes the shelf, and makes the indicator lights like more discrete orbs. You can do this with the terminal. Using the terminal is also, perhaps, a topic for another discussion.I like the 2D dock much better. If you want I'll give you some directions for how to do it. Otherwise, here's a reference: 2D Dock - MacRumors Forums

  • Looking for professionals with Illustrator scripting experience near Nürnberg Germany

    I work for a large consumer products company with a large in-house design team working on Illustrator as a main platform. I'm looking for advice on where to find individuals with a lot of Illustrator scripting experience to help our team for a limited time duration. Any thoughts on other forums, job posting sites etc. where I could search for this would be greatly appreciated. Our company is located near the Nürnberg metro area in Germany and ideally are looking for on-site help. Thanks!

    I know at times it doesn't look like it but I do have a day job ( just about ) Carlos… Language would a problem too ( I just about do english as we brits do, pig ignorant bunch ) I've been to Hamburg and the beer was great thou…
    I don't know why but I have think Chris Gebab may be from that way…

  • Looking for help with movie loading in a different spot every time page reloads.

    Hello,
    I have a Flash movie that I need to jump to a one of 6 chosen frames when say a user hits the back button or home in the site. I just dont want the same user seeing the flash movie replay in the same spot everytime they go back to home.
    ANY help with this is appreciated.
    Thanks ahead of time.
    -Ann
    Here is what I have scripted:
    var numbers:Array = [2,114,415,687,960,1195,1485];
    _root.firstTime = true;
    if(firstTime) {
        firstTime = false;
        var frame:Number = Math.floor(Math.random() * numbers.Length);
        gotoAndPlay(numbers[frame]);
    I have also tried this:
    Array.prototype.shuffle = function() {
    for (var ivar = this.length-1; ivar>=0; ivar--) {
    var p = random(ivar+1);
    var t = this[ivar];
    this[ivar] = this[p];
    this[p] = t;
    ASSetPropFlags(Array.prototype, ["shuffle"], 1, 1);
    var Array_ar:Array = new Array(2,114,415,687,960,1195,1485);
    Array_ar.shuffle();
    index = 0;
    function load_random() {
    gotoAndPlay(Array_ar[index++]);
    if (index == Array_ar.length) {
    (index=0);
    load_random();
    But this keep jumping to frame 1 each time i hit back or refresh.
    Thanks again.

    That did not work. It loops back to the frame that it first loaded to not to frame 1 the beginning.
    It tried putting gotoAndPlay(numbers[frame]); on the very last frame, then I made a new keyframe after the very last frame and neither worked.
    You can see the swf here:
    http://www.shared-vision.net/testsites/edi/EDIflashtest2.html
    Thank you for your help.
    -Ann

  • Mail.app - Applescript - Looking for help with my 1st Applescript

    Okay… so I am taking the plunge. I've finally found something that is bugging me enough that I want to make a script to resolve it.
    *Here's the situation:*
    I use Smart Mailboxes a lot. It's my primary window into dealing with email.
    I use MailTags (an addon for Mail) to apply keywords to messages, via Mail Act-On rules (an addon by the same company).
    I use Smart Mailboxes to show me messages with various keywords etc.
    What I have found is that Smart Mailboxes do NOT automatically update themselves. For instance, when a message in the Smart Mailbox is changed in such a way that the filter on that mailbox should not display it, the message will still sit there until I either leave the mailbox and return, or hit Rebuil in the Mailbox menu.
    The same applies for when new mail comes into my Inbox. If there is new mail that qualifies for inclusion in the smart mailbox I am currently viewing, it will not appear until I do one of the above two things.
    What I discovered was this script:
    tell application "Mail" to activate
    tell application "System Events"
    click menu item "Rebuild" in menu ¬
    "Mailbox" in menu bar 1 of process "Mail"
    end tell
    This is what got me thinking about scripting a solution.
    The other option is to assign a keyboard shortcut to the Rebuild command. But I would like the Rebuild to take place automatically when I apply certain rules to messages. I want my Mail Act-on rule to trigger the a Rebuild. I figure I can do this by having it trigger the Rebuild script shown above.
    *HERE IS MY QUESTION:*
    Is there a way to have the script check what the currently active/selected Mailbox is? Or, put another way, can I get it to NOT run if certain mailboxes are selected?
    Here's what I am thinking.
    Under no circumstances do I want this script to be triggered if the current mailbox is NOT a smart mailbox, and IS any of my IMAP mailboxes… most especially the Inboxes. That would trigger a complete cleaning out and rebuilding of the entire IMAP inbox, which has many gigs of mail in it.
    What I am trying to figure out, and would love some help with, is how I can make sure this script ONLY runs when the current mailbox is either ANY smart mailbox, or NOT an IMAP mailbox, or some other logic that keeps it from running in an IMAP mailbox.
    Any tips are greatly appreciated.
    With thanks,
    Jonathan
    Message was edited by: InspiredLife
    Message was edited by: InspiredLife

    Thanks Camalot,
    I appreciate your help with this. I am also enjoying learning more about AppleScript. It seems much easier that other scripting languages, if for no other reason that it uses basic english logic and words.
    When I run your script with an inbox selected, I get the following Result:
    tell application "Mail"
    get selected mailboxes of message viewer 1
    --> {mailbox "INBOX" of account "JE Gmail"}
    end tell
    Result:
    {mailbox "INBOX" of account "JE Gmail" of application "Mail"}
    When I run it with a smart mailbox selected the following is produced:
    tell application "Mail"
    get selected mailboxes of message viewer 1
    --> {current application}
    end tell
    Result:
    {application "Mail"}
    So get the impression it's not throwing up an error. Certainly, either way it does not run what I put into the On Error section, which was simply
    display dialog "Success"
    Is this useful? Can I test if the output contains the word "INBOX" ?
    I notice that if I have, for instance, a SENT folder select, it gives the following result:
    Result:
    {mailbox "INBOX/Sent Messages" of account "[email protected]" of application "Mail"}
    Which again has the word INBOX in there. Drafts comes up a little different.
    Result:
    {mailbox "Drafts ([email protected])" of application "Mail"}
    So if there was a way to parse the result through a test against "INBOX" "DRAFT" etc then this might work. What do you think?
    I have no idea how to go about that though, so your input would be very helpful.
    Thanks,
    Jonathan

  • Looking for help with using a NAS to store iphoto library.

    I have a Seagate Business Storage 2 bay NAS and wish to move my iphoto library out of my MacBookpro to the NAS so it can be accessed from my iMac or the other user on the MacBook pro (appreciate that this can be done without NAS but need to make space on the MBP).  I have partially achieved this but get messages saying that cannot access file (reset permission rights) despite the file not being open by any user.  I'm competent but not massively techy and desperately need help.

    SImple: You can't do it.
    Two reasons: typically a NAS is the wrong disk format. Secondly having an iPhoto Library on a network is not recommended.
    iPhoto needs to have the Library sitting on disk formatted Mac OS Extended (Journaled). Users with the Library sitting on disks otherwise formatted regularly report issues including, but not limited to, importing, exporting, saving edits and sharing the photos.
    See this article
    http://support.apple.com/kb/TS5168
    for more. Note also the comment:
    “Additionally, storing the iPhoto library on a network rather than locally on your computer can also lead to poor performance or data loss.”

  • Hello to all ... looking for help with 7520

    Hey I got a 7520 and want to know how I can get my computer to sync ?? or recognize my phone so I can load Pictures from the computer to the phone.

    Hey BigSteve!
    Here is a write up that should help you:
    http://supportforums.blackberry.com/rim/board/message?board.id=BlackBerryDesktopSoftware&thread.id=3...
    Cheers!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • New to inDesign - looking for help with creating booklets

    Looking for a tutorial/answer on how to set up my book so that the pages can be printed, folded in half (like a brochure/magazine) so that I can bind the pages myself in a book.   Not sure if my page size would be what I want the finished book size to be or if I need to double the page width setup size, because I will be folding them in half to put the book together.  I know there must be a magic button as well that will sort the pages and keep them in the right order, once I fold them.   Does this make sense to anyone?

    Hi 4boyz,
    You can refer to the below mentioned links:
    https://www.youtube.com/watch?v=GY16m7QcFj4
    https://multimedia.nscad.ns.ca/pdfs/indesign-2%20sided%20saddle%20stich.pdf
    https://www.youtube.com/watch?v=BCoTJZXkgSQ
    https://helpx.adobe.com/indesign/how-to/make-brochure.html
    http://www.creativebloq.com/indesign/brochure-design-4112750
    InDesign Help | Creating book files
    http://smallbusiness.chron.com/layout-book-indesign-27014.html
    Some other links to learn Indesign:
    InDesign CC tutorials | Learn how to use InDesign CC
    http://tv.adobe.com/show/learn-indesign-cc/
    InDesign Help | InDesign Help
    http://helpx.adobe.com/pdf/indesign_reference.pdf
    http://vc.uscannenberg.org/sites/vc.uscannenberg.org/files/documentation/31/Adobe%20InDesi gn%20Beginner%20Tutorial.pdf
    http://ptgmedia.pearsoncmg.com/images/9780321926975/samplepages/0321926978.pdf
    http://ptgmedia.pearsoncmg.com/imprint_downloads/peachpit/peachpit/academic/IDCCCIB_Instru ctor_Notes.pdf
    Thanks,
    Nikhil Gupta

  • Looking for help with converting a ppsx file to a video format such as .mov or mp4

    Hi All,  I am looking for conversion software that will allow me to convert a ppsx file to a video file on OS10.5.8. 

    Hi Klaus1, Thanks for your response.  I can open and view the file without difficulty.  My issue is getting into a video format that I can upload to a Website for client viewing.  All the conersion products I can find are for a newer OS then 10.5.8.  I am working on a deadline of midnight tonight-and cannot upgrade that quickly.  So What I need is a conversion program that will still run on my OS

  • Help with powershell script

    I have an powershell commando that pulls all my machines of xenapp 7.6 that are registered.
    But i want my script to show me output when an machine is unregistered. Can any one help me out with the if and else statement.
    This is for registered machines:
    Get-BrokerMachine | select MachineName, RegistrationState | Where { $_.RegistrationState -eq 'Registered' }
    Th is for Unregistered servers:
    Get-BrokerMachine | select MachineName, RegistrationState | Where { $_.RegistrationState -eq 'UnRegistered' }
    Output is like this:
    MachineName                                                                                          
    RegistrationState
    XXX\wsgrswxa01                                                                                               
    Registered
    XXX\wsgrswxa02                                                                                               
    Registered
    XXX\wsgrswxa03                                                                                               
    Registered
    I tried a little bit with if and else statement. But i don't know how to do it.
    (example):
    if(?)
    echo “OK status – All XenApp machines or OK”
    exit 0 #Return OK status
    else
    echo “CRITICAL status – These Machines(xxxx,xxxx) are Unregistered”
    exit 2 #returns critical status
    Can anyone help me out?

    Hi,
    you do that by 1) saving the query for unregistered machines, 2) Checking whether there are any unregistered Machines from that variable and 3) Writing down the names (again from the variables).
    Cheers,
    Fred
    oh, ok, here you go :)
    $Machines = Get-BrokerMachine | Where { $_.RegistrationState -eq 'UnRegistered' }
    if (($Machines | Measure-Object).Count -gt 0)
    Write-Output "CRITICAL status – These Machines ($(($Machines | Select-Object -ExpandProperty MachineName) -join ",")) are Unregistered"
    exit 2
    else
    Write-Output "OK status – All XenApp machines or OK"
    exit 0
    There's no place like 127.0.0.1

  • Sreaming at the top of my lungs for HELP with Java Script problem!

    Hello,
    I have this strange problem that no one seems to know why or how to fix it.Whenever I encounter a web site that has java scripting for anything pop ups or redirects to url's anything that says java script when I mouse over the link my browsers do nothing.That is for explorer 6.0 beta netscape 4.7 and netscape version 6.I have tried in another forum some suggestions but nothing changed even though I am told nothing is wrong with the java scripting.I used to be able to click java script's with all of these browsers but no longer.That was a few months ago.Now to try something new I tried to see if a new browser would work.I now have the latest version of Opera.It did work but using Opera on some sites limits what I can do so it doesn't solve my problem.Then I tried the Sun JavaHot browser it also worked but limits what I can do on some site's.I have Windows 98 & updated most of my dll's etc & my java is version 2 1.3.1.My java script is enabled in Explorer & netscape's & the security is at a minimum level.Please help me figure out why these other browsers work but the other's do not.I want to edit a web site of mine but I can't because of this problem.I am very frustrated by this and need as detailed help as I can get.Anything of a suggestion would be very much appreciated.But I am also not an expert on the working's of a computer so bear with me.
    Brian

    Hi,
    Well I am thinking that if anyone could know something about Java script it would be java developers.But anyways I had the previous version of explorer 5.0 & the java didn't work in it either.Now how weird is this,I opened netscape 4.7 today & the java scripts are suddenly working.This has me scratching my head wondering if my computer is possesed by some force beyond my capability to know...????Weird as it seems though the explorer still will not respond to a java script.
    Brian

Maybe you are looking for

  • Debugging XSL

    I am attempting to migrate an existing application to Oracle XML parser v2 from LotusXSL. There seems to be some incompatibilities which may or may not be real. But I can't tell where the problems are. All I get are exceptions with stack traces deep

  • Customize Portal via API

    Hi, is it possible to customize a portal (for example deleting a portlet or changing layout) using the api? Or is the only way to use the "customize my portal"-link/app? Bye, Ralph

  • Essbase Application grey

    Gurus, I just installed EAS in my database server (and the HSS and other applications are in other server) I can log in to EAS but I cannot create any application. When I right-click Essbasecluster1-Create, the APPLICATION is greyed out. Do I need to

  • Setting what happens if the user presses stop...

    I have a simple dvd set up. Stock menu from encore...3 video clips...3 buttons. If the user is in the middle of watching a video and the press "stop" on the remote, I want it to return to the main menu. How can I do this? TIA Dean

  • Kuickshow doesn't show images anymore

    kuickshow only shows a black window (the size of the image) when I open a picture all other programs, including kde previews (even the kuickshow preview image) work as intended any idea what causes this?