SCOM- Moving folder contents oder than N days

Hi All,
I need a script for SCOM 2007/2012 to move files from Source to Destination folder after n number of days.
For example, if files in source are 14 days old then move it to destination folder.
I can create a custom class, discovery rule for source servers, but I need a script for SCOM Timed Rule.
Thanks in advance.

Hi,
Here is a powershell script to move files from Source to Destination:
$fs = dir c:\source\* | Where-Object { $_.LastWriteTime.date -lt (((get-date).addDays(-14)).date) }
if ($fs) {
move-item -path $fs -destination "e:\destination" }
I think we don't need SCOM, we can run this script as scheduled task also.
Regards,
Yan Li
Regards, Yan Li
... or use Orchestrator.
Vladimir Zelenov | http://systemcenter4all.wordpress.com

Similar Messages

  • TS4002 Messages older than 30 days in inbox are not moved to deleted items when removed.

    I've had a few messages that were stored in my inbox and were older than 30 days. I've noticed that when I actually delete them they aren't moved to Deleted Items (and sat for 30 days before permanently deleted). It seems that the actual date of the email is being used to calculate the age and not the time it sits in deleted items.

    If deleted email isn't being moved to the trash you might want to go to icloud.com from your computer, open mail, click on the gear-shaped icon on the top right and choose preferences, then confirm on the General tab that you have checked "Move deleted messages to" and selected "Tash" from the drop-down list.

  • Powershell Command to permanently delete items in ALL users Deleted Items folder older than X days.

    Does anyone know a powershell command that can be run on Exchange 2010 SP1 that will permanently delete mail in the deleted items folder older than X days for ALL users in a specific database? This should include any user created subfolders in deleted items
    also.
    I know that seems bizarre to have user created subfolders in deleted items but we have found that users have discovered that if they create subfolders then their deleted items dont get purged at the regular retention period time.
    Thank You.

    Hi,
    For Exchange 2010 SP1, we can use search-mailbox and new-mailboxexportrequest to delete message in certain folder.
    Understanding Exchange Search
    http://technet.microsoft.com/en-us/library/bb232132.aspx
    Xiu Zhang
    TechNet Community Support

  • Export -mailbox to move emails older than 400 days to pst file

    i have written the below script
    $date = get-date
    $MailboxList = get-content "E:\del_users.txt"
    ForEach ($Mailbox in $MailboxList) {
    Export-Mailbox -Identity $Mailbox -PSTFolderPath E:\pstfiles\$mailbox.pst -BadItemLimit 1000000 -StartDate $date.adddays(-450).ToString('MM/dd/yyyy') -DeleteContent
    my target is to move all emails older than 450 days to a pst file. i ran this on one user and noticed his emails from today to 450th day from today was moved out.
    In simple terms, i want to move all emails in all sub-folders that are older than 01-January-2014. Once this is done and when he logs to owa or outlook he must be only be able to see emails from 01-Jan-2014 to 17-Mar-2015.
    how can i achieve this with the above script?
    cheers

    We are facing this error with few mailboxes which are exclusively in one DB under one Storage Group & the mailbox is on EX001 with Exchange 2007 SP1
    We have 2 exchange servers:
    EX001 - Exchange 2007 SP1
    EX002 - Exchange 2007 SP3 (fully updated)
    I have setup a Windows 8.1 32bit machine with Outlook 2013 for running the export-mailbox cmdlet to export mails to a PST file
    We are facing this error with few mailboxes which are exclusively in one DB under one Storage Group & the mailbox is on EX001 with Exchange 2007 SP1
    We I run the below script, 
    $date = get-date
    $MailboxList = get-content "E:\del_users.txt"
    ForEach ($Mailbox in $MailboxList) {
    Export-Mailbox -Identity $Mailbox -PSTFolderPath E:\pstfiles\$mailbox.pst -BadItemLimit 1000000 -StartDate “01/01/2005" -EndDate “12/31/2013" -DeleteContent
    I get the below error, only from some users and not all users.
    Error was found for User ([email protected]) because: Error occurred in the step: Moving messages. Failed to copy messages to the destination mailbox store with error: 
    MAPI or an unspecified service provider.
    error code: -1056749164
    I went through the link: https://social.technet.microsoft.com/Forums/en-US/3c75a6db-74a4-484c-a7f4-5b411900d09b/exchange-2007-exportmailbox-error-message-on-only-certain-mailbox?forum=exchangesvrdeploylegacy 
    I understand this is a permission issue and i have tried all of the below
    1. The user doing the export is a member of local administrator group in both source and target machine.
    2. the user doing the export is granted the exchange administrator role on EMC in both the source and target machine.
    3. Given full access permission to the username moving the mailbox to PST
    4. given receive-as permission to the username moving the mailbox to pst
    5. Given genericall access to the DB
    6. Create a New User account (EX: ExportAdmin)
    Add this account to a Exchange Server Administrator Permission Both Source and Target Exchange Mailbox Server
    Add this account to Local Administrators Group Member Both Source and Target Exchange Mailbox Server
    Make sure this account DO NOT HAVE ANY Domain Admin/Exterprise Admin permission(Just keep Domain User group permission)
    Assign Mailbox Full Access to this account by follow Cmdlet
    Get-Mailbox -Server "EX-CCR" | Add-MailboxPermission -User ExportAdmin -AccessRights FullAccess
    Runas with ExportAdmin account (Open EMC)
    Get-Mailbox -Server "EX-CCR" | Export-Mailbox -PSTFolderPath
    Done
    7. On the DB, we set the retention to 0
    however none of the above has helped me resolve my issue.
    Please help me correct this

  • Block invoices of clients that have more than 60 days of debt

    Hello everyone!
    I Hope someone here could help me with something.
    Is there any way to configure SAP BO to block the invoice of those clients that have one or more invoices with more than 60 days of debt (Invoices over 60 days past due balance)??
    I have SAP Business One 9.0 PL5.
    Is someone can help me please let me know!!
    Sorry for my bad english :s and sorry for posting this here, it is my first quetion and I really don't know where to post it (a little kind of confusing).
    Best regards to everyone!

    The tricky part with this is that Move-Item won't create missing folders, which you need if you want to maintain the folder structure, so you'll need to create those manually. This should do what you need.
    # Change the value $oldTime in order to set a limit for files to be copy.
    $oldTime = [int]60 # 60 days
    foreach ($path in Get-Content "G:\Scripts\MoveDownloadDireFiles\pathListTest.txt")
    # Write information of what it is about to do
    Write-Host "Trying to copy files older than $oldTime days, in the folder $path" -ForegroundColor Green
    # copy old files to another folder
    $MoveFiles=Get-ChildItem $path -Recurse -Include *.* | WHERE {($_.CreationTime -le $(Get-Date).AddDays(-$oldTime))}
    foreach ($movefile in $MoveFiles)
    # Find the folder path of the file and remove the drive letter
    $SourceSubFolder=$movefile.DirectoryName.substring(3)
    # Set destination as base path + the folder path of the file
    $DestinationPath="G:\BackupDownloadFolders\" + $SourceSubFolder
    # Test for the destination existance and create if missing, as Move-Item doesn't create folders
    if(!(Test-Path $DestinationPath))
    New-Item -Path $DestinationPath -ItemType Directory
    Move-Item -path $movefile -Destination $destinationpath

  • C: drive is full - move only iTunes Media folder contents to another drive without consolidating?

    My iTunes library contains a combination of music/movies/etc that I've purchased or downloaded from the iTunes Store as well as music I've purchased from Amazon and my own ripped CDs (not ripped via iTunes...other software).  The Amazon and ripped files have always lived on my D drive (for easier sharing betwen family members, without opening up permissions on our User folders), while the Store files all live under my User profile on C.
    I'd like to move the iTunes Media folder contents off of C and onto D.  All the instructions that use "consolidating" and "keeping the media folder organized" will not work for me, since I do not want all my files under the iTunes Media folder...I like them where they are now in D:\Music\Amazon and D:\Music\CDCollection.
    Do I have to resort to moving the files myself, adding them into the library again, then cleaning up the orphaned library entries that are pointing to the old location?
    Thanks!

    Copy the entire iTunes folder from your music folder to D:\iTunes.
    Click the icon to start iTunes and immediately press and hold down the shift key. Keep holding until asked to choose or create a library.
    Click Choose and navigate to the file D:\iTunes\iTunes Library.itl
    Check the library is working properly.
    Use the option File > Library > Organize Library > Consolidate Files to import any stay files to the new library folder.
    Delete the old iTunes folder on the C: drive.
    Ideally you will also backup this library to another drive.
    tt2

  • Premiere pro CC 2014 will not bring entire folder contents into project

    It's a simple finder action, dragging and dropping, yet, I cannot get Premiere to put the entire contents of a folder into the project.
    Lots of editors do some preliminary binning on the drive. It's how we organize footage. An example would be a folder structure that has the DAY then the CAMERA ROLL then a SCENE then even a SCENE BREAKDOWN.
    When I drag the DAY folder into the project I expect the entire structure to be imported, all the subfolders and all the footage.
    It's a hell of a feeling when you drag in the one master folder, and only some of the folders/footage come into the project, and you dont realize until about two days into making selects and have to start over.
    This is what my drive looks like:
    and either dragging or doing file import gives me this:
    no rhyme or reason to what it considers a folder or not. Some its like "sure, lets give him all the subfolders" others its like "ew. folder 01. I hate firsts. lets skip that."
    Computer. Do what I say. I am the master. And Adobe... this is a pretty basic function.
    Thanks for any help or light you can shed on zee subject. . . Adobe community is the best in the world.

    Hi Serrini,
    Sorry about that. Can you file a bug report? http://adobe.ly/ReportBug
    Thanks,
    Kevin

  • Unable to view logs in SM21 older than one day

    I am unable to view any logs in SM21 older than one day.  What parameters need to be checked that would cause this?  Thanks!

    Hello,
    please check this :  rslg/max_diskspace_local & rslg/max_diskspace_central
    http://help.sap.com/saphelp_nw70/helpdata/de/c7/69bcbaf36611d3a6510000e835363f/content.htm
    thanks
    ashish

  • Coping folder contents and sub folders

    So, I'm working on a little practice folder sync project (fun with my mac)...
    ...and I'v gotten hung up a bit because my little copying app doesn't seem to count folders and sub folders (which I suppose makes sense).
    My initial idea was to take just the date of modification and compare it to the last date that the app was run, inorder to only copy changed files. But this seems problematic on a few levels, so...
    So, my two part question is:
    1. Is there a simple command to copy folder contents and sub-folder contents, or do I need to tell the script to do each sub-folder individually?
    2. I imagine that a better way to manage which files/folders need to be updated is to create a file with a list of the contents, and dates of modification, and compare the new folder list and the old folder list to each-other... ok.. so, um. yeah. that sounds tricky.

    >1. Is there a simple command to copy folder contents and sub-folder contents, or do I need to tell the script to do each sub-folder individually?
    There are two common solutions to this.
    The first is to use the Finder's 'entire contents of...' command to get a list of everything in the folder, including sub-folders, the second is to make your script recursive - that is, it calls itself several times over.
    In the first case it's as simple as:
    tell application "Finder"
    set allItems to entire contents of folder "path:to:source:folder:"
    -- rest of code goes here
    end tell
    This can have problems, though, especially on very large directories since the Finder is not very efficient at building a list of hundreds or thousands of files.
    The recursive path is a little trickier, but you write a handler to process a folder then repeatedly call that handler, like:
    <pre class=command>on run
    set sourceFolder to (choose folder)
    processAFolder(sourceFolder)
    end run
    on processAFolder(theFolder)
    tell application "Finder"
    set allItems to items of folder theFolder as alias list
    repeat with eachItem in allItems
    if class of eachItem is folder then -- we have a subfolder
    processAFolder (eachItem)
    else
    -- code here to compare the file and back it up
    end if
    end repeat
    end tell
    end processAFolder</pre>
    So here you walk through the folder, each time you find a new folder, you walk through that until you're done. The code takes care of keeping track of where you are in the folder hierarchy.
    >2. I imagine that a better way to manage which files/folders need to be updated is to create a file with a list of the contents, and dates of modification, and compare the new folder list and the old folder list to each-other... ok.. so, um. yeah. that sounds tricky.
    There's no need to keep a file. Assuming you have two folders you can just walk through one of them checking to see if each item exists in the other, then copy the newer file to the other directory, like:
    <pre class=command>on processAFile(fileName, sourceDir, destDir)
    tell application "Finder"
    -- check if the files exist
    set sourceFileExists to (file fileName of folder sourceDir exists)
    set destFileExists to (file fileName of folder destDir exists)
    -- now comes the logic
    if sourceFileExists and not destFileExsits then
    duplicate file fileName of folder sourceDir to folder destDir
    else if destFileExists and not sourceFileExists then
    -- assuming you want a two-way synch
    duplicate file fileName of folder destDir to folder sourceDir
    else -- both files exist, so check mod dates
    if (modification date of file fileName of folder sourceDir) > (modification date of file fileName of folder destDir) then
    duplicate file fileName of folder sourceDir to folder destDir
    else if (modification date of file fileName of folder destDir) > (modification date of file fileName of folder sourceDir) then
    duplicate file fileName of folder sourceDir to folder destDir
    end if
    end if
    end tell
    end processAFile</pre>
    If you're not planning a two-way synch an even simpler option is to just keep track of the last time the synch was run. Then all you need to do on subsequent runs is ask the Finder for 'every file of folder sourceFolder whose modification date is greater than lastRunDate'.

  • Viewing 'deploy to web' folder content on computer

    Hey everyone.  I have been having this problem for the past few days and finally got an answer from the Adobe help line.  But, adninjastrator helped me a lot, too!  I wanted to post the solution on here for anyone who might have problems with this in the future.
    Basically, I thought I had a glitchy version of Flash Catalyst because I couldn't view my 'deploy to web' folder contents on my computer.  The video I would upload onto it just wouldn't play, like there was no video there, just the videoplayer skin.  Well, apparently you can only view your 'deploy to web' files once you publish everything to a server.  Here's a copy of the thread I had in Flash about this.  Hope it helps people in the future!
    Adobe called me back late afternoon yesterday.  They said that there is no way you can view the 'deploy-to-web' files straight from a computer.  They said that you HAVE to upload it to a server in order to view it.  I've never heard of that for other video and web applications.  That's so odd...  So I wasn't expecting anything like that at all.  I told them that it would probably be a good idea to make that much more apparent to people since most of us like to test our content BEFORE we upload it.  The uploading process takes long enough.  We don't want to spend all that time uploading and then see that something doesn't work right.  Hopefully they make that apparent in the future.  But he did give me instructions on how to access a local server just using your computer, not going to a free website hosting company or anything.
    Here are the instructions on how to access your local host on the computer.  This has to be done using a Windows computer or a Windows partition like I have.  I don't know the instructions on how to do it for a Mac.  I hope these instructions make sense and help you, motvsonofjack.
    Version:1.0 StartHTML:0000000177 EndHTML:0000005707 StartFragment:0000002174 EndFragment:0000005671 SourceURL:file:///Users/MacPro/Desktop/ImportantFiles/Local%20Host.doc                     Local Host - Windows internal server: - Go to Control Panel/Programs and Features- On left hand side, click 'Turn Windows features on or off'- Go to option 'Internet Information services'. Click box beside it (Options selected after clicking plus button should be 'Web Management Tools' and 'World Wide Web Services')- Open Internet Explorer and type in address bar: localhost to check if server is working- Go to Computer/Local Disk (C:)/inetpub/wwwroot- Create new folder here and name it whatever you want (ex. deploy)- Paste files into this folder (ex: Flash Catalyst 'deploy-to-web' folder contents)- Go to Internet Explorer and type in address bar: localhost/nameofcreatedfolder(ex:deploy)/main.html(or whatever file you want to play) - Website should run

    Hi there,
    I can view your swf under http://www.skribblz.com/Main.swf (although it looks to be just a background).
    http://www.skribblz.com/index.html is still your old page.
    What you'd normally do to modify your webpage, is:
    Copy the contents of the deploy-to-web folder, to the public-html folder.
    Verify that yourdomain/Main.html, and yourdomain/Main.swf both load correctly
    Delete index.html.
    Rename Main.html to index.html
    You should not rename the swf.
    -Bear

  • How do I move 10.10.1 picture folder contents to an external drive?

    I have recently changed to mac mini and would like to move my picture folder contents to an external drive. Is there a correct way to do this beside just dragging and dropping?

    Dragging and dropping is enough. If you’re moving an iPhoto library, the volume you’re putting it onto needs to be formatted as Mac OS Extended, and you need to launch iPhoto with the Option key held down and choose that library.
    (118427)

  • Hi, My recent trip pics on my iphone are more than 30 days old and my icloud photo sharing had been turned off.  How do I now share them to my PC which is on the icloud photo sharing?  I want to save/print these once shared to my PC.  Help?

    My trip pics are more than 30 days old and my icloud photo sharing was turned off.   How can I now share them to my PC for saving/printing?  My sharing is now turned on but it's not loading them?  Help?

    That list includes all the apps that you installed to your device directly from iTunes on the computer, or which were purchased on the iOS device and subsequently transferred to iTunes on the computer.
    If you right click on any item in that list and choose "Show in Windows Explorer" it will open your iTunes application installer directory on your computer, which should be:
    C:\Users\User\Music\iTunes\iTunes Media\Mobile Applications
    In there are all your saved application installers (*.ipa files).  You need to delete those actual installer bundles and then make sure to NOT allow the "transfer purchased content" when you sync or backup in iTunes (as that will just put them back on your hard drive).
    One caveat to removing those, is that if you ever wish to keep a specific release of a particular app, and the developer replaces the iTunes/App store version with something else, your sole source for your older version will be your own stored copy of it.  So for example, when PDF expert released their iOS 7 update, and charged everyone full price for it, if you wished to keep using the previous version on your own devices, then you needed to keep a copy of the installer on your own computer as that older version is no longer available in the store front.

  • HT2518 i have used migration assistant to move emails in outlook to mac but some of emails moved without contents, any solution for this problem?

    i have used window migration assistant to move emails in windows pc to mac. mails mostly moved without problem but some of them moved without content. i tried to find out if there is anything common in these emails of problem but cannot identify any hint. please help

    The Dropbox folder is a subfolder of the home folder, which has the same name as the user account. It's under the Users folder at the top level of the startup volume ("Macintosh HD," unless you gave it a different name.)

  • E50 battery drains in less than a day

    My E50 has started draining the battery in less than a day. IN fact, it lasts roughly 10 hours and that is assuming nobody actually calls me.
    I have:
    - bluetooth off
    - screen off almost all the time
    - autlock installed to lock the device down
    - nothing running except the "standby" page
    I do use Exchange Activesync, and that does suck a lot of power - but even so 10 hours is ridiculous, not too long ago it lasted easily a few days even with some syncing during the day.
    Any ideas? Battery going bad?

    Is your GPRS connection constantly activated? And are you running in UMTS (Or 3G mode) or GSM as a wonky 3G signal that forces the phone to jump between UMTS and GSM can really kill your battery. If you have moved your geographical area lately it might be that you have moved into an area where there is a poor UMTS signal that is causing this.
    Try putting it in GSM mode for a day and see what happens.
    If nothing try uninstalling your applications and formatting your phone to see if a runaway application is causing it (Back up your data first).
    Failing that, get a new battery (Or claim one under the warranty).
    Useful links: Phone firmware update | Nokia support site

  • Can't choose more than 7 days in Mac Mail rule.

    I'm setting up a rule to have all mail in a given folder deleted after 365 days. I enter 365 (days old) and click enter. Then when I select edit to examine the rule, the days old is 7.   ??? 

    Hi Karl,
    I don't want to speak for Alien Duck, but the issue looks almost exactly like mine.  Which is:
    1. In Apple Mail > Preferences > Rules
    2. Add Rule
    3. Choose "Date received" and "is greater than" and type in "360" for days old.
    4. (Perform any action)
    5. Click Ok
    6. Go back to edit the rule, and notice "days old" has reverted back to 7
    I have version 8.1 of Apple Mail, OS X Yosemite 10.10.1
    ***UPDATE***
    Interestingly enough, I did a test rule (changed the color of messages older than 180 days), and it seemed to work!  So, it looks like a bug only in the alert UI rather than the actual rule itself.  Guess I need to trust it...

Maybe you are looking for