Asynchronous and remote execution with powershell 2 ctp3 - An interesting feature released with the PowerShell 2 CTP3 is the ability to run background jobs consisting of arbitrary PowerShell code. In order to use this functionality you must download and install the PowerShell 2 CTP3 and the WinRM (Windows Remote Management) 2.0 CTP. Keep in mind that installing the CTP requires uninstalling previous versions of PowerShell. Depending on the PowerShell and operating system versions involved the procedure can vary. Google/Bing is your friend. Once bringing up PowerShell you have to enable remoting by invoking the aptly named Enable-PSRemoting cmdlet Enable-PSRemoting -force Now the meat. Consider the following code: # copy bigfile.txt on a background thread $job = start-job -scriptBlock { cp bigfile.txt bigfilecopy.txt } # here's where we'd perform some other logic while our file copies # wait for job...
Tags:
.Net .net framework 4.0 ADO.NET Android AppleScript Astoria BI BeOS C C++ Data Services EF GNOME GObject Groovy HTML Haiku JVM Java Mac MongoDB ORM Objective-C Operating Systems Oracle SSRS Solr VS 2010 Vala Web Services appengine c# clojure cloud clr cocoa touch concurrency couchdb cql curl database django dlr dynamic entity framework erlang exchange server filestream full-text functional go iPhone indexes ironpython ironruby jQuery linq lisp lucene mongodb monitoring natural language object oriented parallel performance podcasts powershell python rails refactoring remoting reporting services rs ruby scripting security setpolicies simpledb sql 2008 sql server systems programming testing tools vb virtualization wave webdav windows xml