How do I Watch a folder on a Mac using Powershell?

Hi All,
I am completely new to Powershell and would love to hear some advice.
I am setting up a network render for After Effects and my mac is the main machine. My system will automatically make an After Effects file and place it into a folder for rendering by a PC, however Powershell fails to recognize a new file in the watch folder
on the Mac
I have set up a watch folder using the following code:
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
    $watcher = New-Object System.IO.FileSystemWatcher
    $watcher.Path = "\\MARKS-MAC-PRO\Macintosh HD\Users\snaplash\Dropbox\AEP_PROCESSING_DO_NOT_DELETE"
    $watcher.Filter = "*.aep"
    $watcher.IncludeSubdirectories = $false
    $watcher.EnableRaisingEvents = $true  
### DEFINE ACTIONS AFTER A EVENT IS DETECTED
    $action = {$path = $Event.SourceEventArgs.FullPath
$name = [System.IO.Path]::GetFileNameWithoutExtension($path)
###New-Item -ItemType directory -Path C:\Users\PC2\Dropbox\PROCESSING_DO_NOT_DELETE\$name
start powershell.exe "cmd.exe /C 'C:\Program Files\Adobe\Adobe After Effects CC\Support Files\aerender.exe' -project $path -comp '$name' -s 0 -e 900 -output C:\Users\PC2\Dropbox\PROCESSING_DO_NOT_DELETE\$name\[#####].jpg"
timeout 2
start powershell.exe "cmd.exe /C 'C:\Program Files\Adobe\Adobe After Effects CC\Support Files\aerender.exe' -project $path -comp '$name'-s 901 -e 1800 -output C:\Users\PC2\Dropbox\PROCESSING_DO_NOT_DELETE\$name\[#####].jpg"
timeout 2
start powershell.exe "cmd.exe /C 'C:\Program Files\Adobe\Adobe After Effects CC\Support Files\aerender.exe' -project $path -comp '$name'-s 1801 -e 2888 -output C:\Users\PC2\Dropbox\PROCESSING_DO_NOT_DELETE\$name\[#####].jpg"
### DECIDE WHICH EVENTS SHOULD BE WATCHED + SET CHECK FREQUENCY  
    $created = Register-ObjectEvent $watcher "Created" -Action $action
     while ($true) {sleep 1}
It see's the folder on the mac, but will not recognize when a file is added. (although this is a Dropbox folder, syncing is turned off)
If I change the location to a local folder on the PC all works well, as does using Dropbox without networking
I can see the location on my PC and all read/write is enabled.
I have also Mapped that as a drive, but still to no avail.
I upgraded to Powershell 3 but cant figure where I an going wrong, any help and advice would be very very welcome!
Thank you All!
Mark

I was actually able to get a trimmed down version of your code to function as you intended on my computer, I used this:
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "\\Server\Users\dnw\test\"
$watcher.Filter = "*.txt"
$watcher.IncludeSubdirectories = $false
$watcher.EnableRaisingEvents = $true
### DEFINE ACTIONS AFTER A EVENT IS DETECTED
$action = {$path = $Event.SourceEventArgs.FullPath
$name = [System.IO.Path]::GetFileNameWithoutExtension($path)
start powershell.exe "cmd.exe /C 'C:\Program Files (x86)\Notepad++\notepad++.exe' -project $path -comp '$name'"
### DECIDE WHICH EVENTS SHOULD BE WATCHED + SET CHECK FREQUENCY
$created = Register-ObjectEvent $watcher "Created" -Action $action
while ($true) {sleep 1}
It waited until I placed a .txt file in the folder noted, and then fired up notepad++
[email protected]

Similar Messages

  • How to create sharepoint Group with read only permissions using powershell for entire site ?

    How to create sharepoint Group with read only permissions using powershell for entire site (including subsites and top level site)

    Hi
    using (SPSite site = new SPSite(url))
    using (SPWeb web = site.OpenWeb())
    SPUserCollection users = Web.AllUsers;
    SPUser owner = users[string.Format("{0}{1}", "Domain", "Owner Username")];
    SPMember member = users[string.Format("{0}{1}", "Domain", "Default Member Username")];
    SPGroupCollection groups = Web.SiteGroups;
    string GroupName = “Super Exclusive”;//your group name
    string GroupDescription = “Super exclusive group description.”;
    groups.Add(GroupName, owner, member, GroupDescription);
    SPGroup NewSPGroup = groups[GroupName];
    SPRoleDefinition role = Web.RoleDefinitions["Read"];
    SPRoleAssignment roleAssignment = new SPRoleAssignment(NewSPGroup);
    roleAssignment.RoleDefinitionBindings.Add(role);
    Web.RoleAssignments.Add(roleAssignment);
    Web.Update();
    Please 'propose
    as answer' if it helped you, also 'vote
    helpful' if you like this reply.

  • How can I move a folder to another catalog using LR 3

    I have imported a large amount of folder into cat#1, but now i have decided to create cat#2. I have tried to move the "folders" and not "catalog" using the following workflow:
    1- Opening cat #1, make selection of folder to be moved
    2- Go to file and select "Export as a cat".
    3- Opened cat #2, go to File and select "Import catalog"
    4- Importing window shows the entire list of folders I had imported previously (lots of them). They all are checked. I can see the path, but only see the location of the folders, but I can't read the name of the files. I am able to see the total number on each folder
    5- I have not even considering "synchronizing" the folder
    Oh another thing, when I go to cat#1 and locate the folder I "exported as a catalog". The folder still shows on cat#1, but I don't see it on cat#2. I guess because I didn't complete the task.
    I find it very tedious process trying to locate the file. And this is where I'm stuck
    I have searched so many ways to find a workflow that would make sense, but I tend to get nothing but responses about how to move a "catalog". I have been thinking doing the following:
    1- Remove the folder from cat#1
    2- Open cat#2 and import the same folder, but this again seems to redundant, boring and a lot of clicking. Any suggestions.

    Hm... Well, for everyone else the reply link is still on the website, and works fine soo....
    Tell me about it. I went to catalog #2 and I didn't see the exported
    catalog. Then I went back to catalog #1 and I still can see the entire
    folder that I had selected to Export. I double checked it the process and it
    seemed ok, but apparently there's something missing to complete the export
    You seem under the impression that exporting as a catalog removes the images from the first catalog.  This is not true.  As I said earlier, it makes a copy for you.  So of course, when you go back into catalog1, all of your images/collections/etc, are still there.  As they should be.
    So, you say you didn't see anything in your exported catalog?  Are  you sure you are opening the same catalog you just exported, or  have you opened a new blank one that you created, accidentally or not?  That would be my guess.
    I think you should start over, and very carefully take it one step at a time.
    Dj has suggested not using include negatives, and I can see where that might be useful.  However, if you do that, you will end up having images from two different catalogs in the same folder.  This will cause problems if you ever use the "sync folder" option, as it will attempt to load all images in that folder into your current catalog. Which means you could easilly end up with all your images in both catalogs.  Messy.   So to avoid this, use a new place instead.  You can also avoid having to do the "import to catalog" step by exporting the negatives at the same time.  Don't worry about exporting previews, though.
    First, find a new place (external disk, whatever) to create a new catalog in.  Do _not_ create the new catalog your self!  Make sure you are sending everything to a new place!
    Now, go into catalog1, and select all of the images you want to export.  They have to be selected, or nothing happens, and you'll just get a blank catalog.
    Now, export as catalog those images into the new location, and make sure you are copying the negatives too!  Double check before you hit go!
    Now, using LR, open that new catalog; you can either double click on the new one, or browse to open it.  Either way.  Verify that your images are in the new place and everything looks good.  You can see in the Folders tab on the left panel to make sure the images are in the right place in the new folder.
    At this point, you should have 2 and a half catalogs;  your new catalog with only the images you exported, and the old catalog, with all of your images.
    Now, you have a couple of choices.  But before you do either of them, make sure you backup your system, including all of the images in the original catalog.  If you've messed up making the new catalog (you should be able to tell!) then you want to make sure your original catalog can be restored.
    Open your original catalog again, and now remove all of the images you exported.  You will need to use the "remove from disk" option, as they will stay in the folders if you don't.  This would cause the above problem with "sync folder", and of course, use double the disk space.
    You can obviuosly see why I said to back everything up first;  if you messed up the export by not including the negatives, you could easilly delete your originals, and not have them _anywhere_, in which case  you would have to restore from back up and try again.
    You now have two separate catalogs.
    Remember, backup everything first, and good  luck!
    Cheers!

  • How to add multiple users permissions to a calendar using powershell?

    I have an organization that was recently setup in Exchange Online and they have unique circumstances in that every user in the organization needs "reviewer"
    access to every other users calendars.  I cannot change the default permission since new users added after this should not be able to see these calendars details.  There are a few I will go back to run a Set command on to change an individual permission
    here and there for specific needs, but the main need is below.
    I have basic experience with powershell commands and have found how to manually add a single users permissions to a calendar using the command below:
    Add-MailboxFolderPermission -Identity alias:\calendar -user alias -AccessRights reviewer
    Since it's not realistic to run this command thousands of times changing the user aliases each time, I was hoping someone could help me build a command to run on a single mailbox's calendar that would add every current user in the organization with certain
    permissions such as "reviewer" or "availabilityonly".
    Thanks for the help!

    Hi,
    A possible solution is to do this via Security Groups.
    Add-MailboxFolderPermission -Identity [email protected]:\Calendar -User [email protected] -AccessRights Owner
    This way, you simply add users that require access to the CalendarOwnerAccessGroup
    You still have to run this on every mailbox that should have this feature, but that could be solved using powershell piping.
    http://technet.microsoft.com/en-us/library/ee176927.aspx
    /Anders Eide

  • How to add hash table values to SQL Table using Powershell

    Hi,
    I have sharepoint list with four(column1, column2, column3,column4)columns.I am reading the list column values and adding to hashtable. Now I want to add values from hastable to SQL table with four(column1, column2, colum3,column4)columns using powershell.
    I have written the following script for single column but I would like to know how to add values for multiple columns.
                if(($key -eq "Column1") )
                   $SqlQuery = "INSERT INTO [TableName] ([Column1]) VALUES ('" + $HashTable.Item($key) +"')"
                   #Set new object to connect to sql database
                   $connection = new-object system.data.sqlclient.sqlconnection
                   $Connection.ConnectionString ="server=SQLServerName;database=SQLDBName;Integrated Security = True;"
              $connection #List connection information 
                   $connection.open() #Open Connection
                 $Cmd = New-Object System.Data.SqlClient.SqlCommand
                 $Cmd.CommandText = $SqlQuery
                   $Cmd.Connection = $connection
                  $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
                  $SqlAdapter.SelectCommand = $SqlCmd
                  $DataSet = New-Object System.Data.DataSet
                  $SqlAdapter.Fill($DataSet)
                  $DataSet.Tables[0]
                  $connection.Close()
    Can anybody please help me out to accomplish the task? Any help would be greatly appreciated.
    AA.

    Hi AOk2013,
    Not knowledgable on PowercShell, based on my understanding on HashTable in Java, Some modification you can make in your code to achieve your requirement.
    If the Keys in HashTable are "Column1","Column2","Column3","Column4", you can reference below.
    if(($key -eq "Column1") ) #what is the purposed of this if ?
    #$SqlQuery = "INSERT INTO [TableName] ([Term]) VALUES ('" + $HashTable.Item($key) +"')"
    #specify the real column names in the table
    $SqlQuery = "INSERT INTO [TableName] ([ColumnA],[ColumnB],[ColumnC],[ColumnD]) VALUES ('" + $HashTable.Item("Column1") +"','"+ $HashTable.Item("Column2") +"','"+$HashTable.Item("Column3") +"','"+$HashTable.Item("Column4") +"')"
    #Set new object to connect to sql database
    $connection = new-object system.data.sqlclient.sqlconnection
    $Connection.ConnectionString ="server=SQLServerName;database=SQLDBName;Integrated Security = True;"
    $connection #List connection information
    $connection.open() #Open Connection
    $Cmd = New-Object System.Data.SqlClient.SqlCommand
    $Cmd.CommandText = $SqlQuery
    $Cmd.Connection = $connection
    $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $SqlAdapter.SelectCommand = $SqlCmd
    $DataSet = New-Object System.Data.DataSet
    $SqlAdapter.Fill($DataSet)
    $DataSet.Tables[0]
    $connection.Close()
    Since your question is regarding PowerShell, I would suggest you post it in a dedicated
    PowerShell Forum. It is more appropriate and more experts will assist you.
    If you have any feedback on our support, you can click
    here.
    Eric Zhang
    TechNet Community Support

  • How to add new group entry in Cisco Vpn using powershell

    I am working on a powershell script to connect cisco vpn using powershell, I am able to connect to vpn but not sure how to add new group to vpn. I am using the following script$vpn_profile = 'Test'
    $username = 'TestUser'
    $userPassword = ConvertTo-SecureString -String "Password" -AsPlainText -Force
    $credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist
    $username,$userPassword
    $password = $credentials.GetNetworkCredential().Password
    Set-Location 'c:\Program Files (x86)\Cisco Systems\VPN Client'
    .\vpnclient.exe connect $vpn_profile user $username pwd $password
    Write-Host "You Are Connected"
    cd "C:\"

    Have you entered .\vpnclient.exe /? to see if it will return information about other switches you can use with this executable? Other than connect, I was able to track down a few without actually having the executable (http://www.scribd.com/doc/40108893/Cisco-VPN-Client-Command-Line).
    That said, I do not believe that there is a switch that will help you create a connection. These are either done manually through the GUI, or can be likely be added by supplying a properly formatted file in the proper place.
    If you're using the version of the Cisco VPN client I think you are, then your connection settings, or profiles, are stored in individual .pcf files somewhere on your computer (likely in the Cisco directory). These are simple, text-based files. Find one
    on your computer, save it with another name, and then modify it manually. If you really want to use PowerShell, then use this opportunity to learn how to create and edit basic text files using PowerShell. If you have a standard connection file, then you can
    put that file onto remote computers any number of ways. If a .pcf file exists in the proper place when the VPN client is opened, then it likely will not prompt for a new connection.
    Update: Added more info; clarified

  • How to content migrate from e-room to sharepoint using powershell

    Hi,
    How to  do content migration from e-room to share-point using powershell.
    Please give step by step process and give some idea about migration using powershell and other tools.
     Thanks,
    inguru

    Hi,
    There is no direct content database migration approach from eRoom to SharePoint.
     However many third party tools such as Metalogix, Tzunami, and AvePoint are available to migrate eRoom content to SharePoint as well as you can write your own utility
    to migrate content since there are various eRoom API available for the same.
    Thank You, Somnath Matere

  • How to set Current quota template dropdownto 50 GB using powershell script

    In central administrator under Application Management -> Configure quotas and locks  we have Current quota template drop down. I  want to set drop down value to 50 GB using powershell . Is it possible and it if it possible then How ? Please
    let me know 
    Thanks in Advance 
    Regards
    Subhash
     

    Hi Sub_84,
    A quota template consists of storage limit values that specify the maximum amount of data that can be stored in a site collection. When the storage limit is reached, a quota template can also trigger an e-mail alert to the site
    collection administrator. You can create a quota template that can be applied to any site collection in the farm. The storage limit applies to the sum of the content sizes for the top-level site and all subsites within the site collection.
    You can create quota template using powershell, ojbect module and sharepoint UI.
    Create new Quota template using powershell:
    $newQuotaTemplate = New-Object Microsoft.SharePoint.Administration.SPQuotaTemplate
    $newQuotaTemplate.Name = "New Quota Template"
    $newQuotaTemplate.StorageMaximumLevel = (150 * 1024) * 1024
    $newQuotaTemplate.StorageWarningLevel = (100 * 1024) * 1024
    $newQuotaTemplate.UserCodeMaximumLevel = 300
    $newQuotaTemplate.UserCodeWarningLevel = 300
    $contentService =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
    $contentService.QuotaTemplates.Add($newQuotaTemplate)
    $contentService.Update()
    Check the link which can guide you how
    http://www.c-sharpcorner.com/uploadfile/anavijai/quota-templates-in-sharepoint-2010/
    Please mark the Answer and vote me if you think that above solution can help you to resolve the issue

  • How to pass input arguments to Worker Role Application using Powershell

    Hi All,
    I have a worker role running in Windows Azure Portal. I need to pass arguments to this Worker role service and get the output by using PowerShell.
    Can someone please specify how this can be achieved using PowerShell?
    Thanks and Regards,
    Vivek

    Hi,
     Please refer to the Following StackOverflow article that talks about how to configure PAAS instances for Powershell remoting.
     http://stackoverflow.com/questions/15787768/accessing-azure-cloud-service-paas-instances-via-powershell-remoting
    Regards,
    Nithin Rathnakar

  • How best to move user folder to a Mac Mini + external drive

    I am streamlining my desktop computer setup. Whereas before I was using a PowerMac G5 as my primary desktop computer, I realize I am using my MacBook Pro more often, so in the interests of conserving space, I will be switching over to a Mac Mini connected to my AV system for hosting all my iTunes music, videos, media, photos, etc.
    Here is where I need advice. My PowerMac has a lot more media on it than can fit on the internal hard drive of a Mac Mini. I have already secured a 1 TB external drive which will be permanently connected to the Mac Mini, but I am unsure as to how to best go about copying my data to it.
    My initial thought was that I could move the iTunes music folder to the external drive using the library consolidation feature, and I could copy my iPhoto library to it, then point the respective applications to the new location. However, I want the external to act as my home folder where the OS looks for all my personal data, including movies, documents, etc.
    I know there is a procedure for changing your home folder's location to an external drive, but because of the limited size of the Mac Mini's internal HD, I would like to use migration assistant when I first start using the Mac Mini. Should I hold off on moving the home folder until after I have migrated, or can it be done beforehand?
    Anyone have any thoughts or ideas? Thanks!

    Thanks for the procedure. It seems very easy, but I am wondering about the consequences depending on when I do it. For example, let's say I first copy my entire home folder to the 1 TB external drive, set up the PowerMac to use it as my home folder, then use migration assistant to import my user accounts, applications, and settings onto the Mac Mini. Will it try to extract the data from the external drive onto the Mac Mini's internal drive? There won't be enough room for everything.
    As an alternative, I can move my iTunes library and iPhoto library onto the 1 TB external first, keeping the rest of my user data in its original location. Then it can fit on the Mac Mini, and I can do the migration, then move the home folder to the 1TB external once it's all up and running on the new computer.
    Which will work best?
    I had heard about people using a single drive as their home folder across multiple computers, but that is not the case for me. My MacBook Pro will become my primary computer, but I intend to keep it clear of media, whereas the MacMini will become my media server for my AV system in my living room. The 1 TB will be constantly connected to the Mac Mini, so there shouldnt be a problem with starting it up once the user folder location has been moved.

  • OS 10.10 how to hide/show a folder with a password using terminal

    In Yosemite 10.10.2 Terminal Can you please tell me how to hide/show with a password then show again on already existing folder created on a system drive and also an external drive. Please provide the path text to folder name "wbfiles". Thank you Winwoodb

    You can drag it from one place on a drive to another.  If you are moving it from one drive to another then it copies it.  If you are moving it on the same drive and are getting that message then not being able to move the folder is the least of your problems.  Free up space immediately because your computer is about to crash and probably lose files.  Then you'll have lots of space.

  • How Do I Move A Folder On My Mac So It's Only In My Files?

    So I made a folder on my iMac, and I want the folder to be off of the desktop screen. I still want to be able to access it by going to the Finder and clicking it, but I just want it off of my desktop screen. Can anyone help me?

    Then move it off the desktop to the ROOT of your User folder.
    Open Finder and click on your Username. in there you will see a folder called Desktop, click on that folder (That is what is displayed on your desktop) find that folder and Drag it to your Username folder.
    Then once it is moved to the ROOT of your Username folder you can then Drag it to the sidebar Favorites area to create an Alias to it in the sidebar.

  • How to back up Home folder to Time Capsule using Backup in OS 10.4.11

    I'm new to Time Capsule, but just set up one that I was given, which does 802.11n wireless. No problem connecting to my Intel MacBook and Time Machine. HOWEVER, using Backup v 3.2 on a Dual G4 running OS 10.4.11 was not seamless. The Backup app (needs a MobileMe subscription to use over 100 Mb) gave me the option of a Time Capsule backup, but kept failing to back up my Home folder. The reason given was not enough disk space. Not the problem; plenty of space when I accessed Time Capsule using Airport on my MacBook (OS 10.5). Finally I accessed the Time Capsule from the G4 using the path: Finder => Go => Network => Time Capsule => Connect => TC Password. In other words, I had to access the Time Capsule as if I were networking to another computer.
    So had Backup given me some instructions along this line, I wouldn't have had to dither around so long. When I quit Backup and reopened it, the backup plan for the home folder proceeded as normal.

    I've found a solution, no need to post a response. Thanks!

  • HT3819 How do I watch a DVD  in my Mac on my TV screen with apple TV

    Thats it,  can I put the DVD movie in my Mac and watch it in the living room on my TV with the apple TV device

    No

  • How do you watch Adobe TV on a Mac?

    Hi,
    It may be obvious, but I must be missing something.  My software is up to date.  When I go to watch something on Adobe TV, nothing happens.
    Thank you for your help.

    I'm running Lion 10.7.1 and I use Firefox 6.0 with Flashblock 1.5.15.1 and I can see Adobe TV just fine.
    Adobe TV uses Flash, so I have to click on the video (due to Flashblock) and then it plays fine.
    Do you run Safari? I did, but found Firefox to be a better solution, espicially since upgrading to Lion. I had Click To Flash on Safari and when I upgraded to Lion, it wasn't working properly. So if you are blocking Flash under Safari, turn it off. Or perhaps, turn off all plug-ins to see if that works. Or try Firefox. Having used it since Lion upgrade, I find I like it for certain features, which I use all the time. Plus, it's not such a CPU hog as Safari turned out to be in Lion.
    Also, check to make sure your Flash player is up to date.

Maybe you are looking for

  • How do I add a jpg photo into the library

    I am trying to animate a layer on top of a background, I've made the background layer the first in the back but when I animate it dissapeers. I can use one of the stock backgrounds from the library and it stays in thebackground while the other gif la

  • URGENT: Changing System Landscape in ChaRM

    Ok...here is our situation: We use ChaRM with a 3 tier system landscape (DEV > USER  >  PROD). Out USER system has been down for a month (maintenance) so we went live with ChaRM as follows: DEV > PREPROD >PROD Our USER system is now back up and runni

  • Problem using icommand in UNIX

    Hi, I'm trying to use icommand in UNIX. I navigate to the middleware home on the server and in the .../BAM/Bin directory I can see an icommand.bat file and the standard icommand file. However, I can't see an icommand.sh file. I've tried some commands

  • Flash 8 crashing

    Hi everyone, My Flash 8 programme is creating problems. Whilst working on an fla, I save my work every five minutes. However, after some time, I get the following message: Could not save as abc.fla. The file may be read-only or is already open in ano

  • Bookmarking Project progress

    I am creating content that is being distributed in an LMS. Everything seems to be working fine except the Captivate 4.0 LMS Customization Settings option Never send Resume Data does not appear to be working. My understanding from Adobe help is that i