Register : : Login
menuleft menuright
submenu
 
Nov 29

Written by: Richard Siddaway
Thursday, November 29, 2007 10:13 PM  RssIcon

The ability to run PowerShell commands on remote machines was at the top, or close to the top, of everyone's requirements for the V2 version of PowerShell.  The V2 CTP delivers remoting functionality.

The Windows Remote Management service must be running on the local and remote machine.  WinRM is the mechanism by which the PowerShell commands are converted to XML and sent to the remote machine.  Note that PowerShell V2 has to be installed on both machines but it does not need to be running on the remote machine nor do you have to be logged into the remote machine.  You do need permissions on the remote machine to perform whatever task you are attempting.

The cmdlet to run the remote command is Invoke-Expression.  This has been significantly enhanced in V2 to enable remoting.

Invoke-Expression -ComputerName dc02 -Command "get-service"

Multiple computer names can be input

This creates a temporary runspace on the remote machine which is torn down after execution.  If you have a lots of commands to run create a persistent runspace on the remote machine

$rs = New-Runspace -computername dc02

This is then used as

Invoke-Expression -runspace $rs -command "get-process"

The runspace must be explicitly deleted with

Remove-Runspace $rs

Interestingly

Invoke-Expression -ComputerName dc02 -Command "c:\scripts\test2.ps1"

will execute a script on a remote machine.

Pipelines can be passed

Invoke-Expression -ComputerName dc02 -Command "get-process | sort CPU -desc | select -first 5"

One issue that I have found is using a where statement in a pipeline passed through invoke-expression.  Interestingly it also fails in V1.  I'd appreciate a working example - I've tried the examples in the V2 help files and they fail.

More information on remoting and runspaces can be found in the V2 help files - about_remoting, about_runspace, invoke-expression

This functionality is very powerful. One thought is how it could be combined with the recently announced SpecOps Command which uses GPO to deliver and run PowerShell scripts.  When that works with V2 then we have the ability to deliver and run scripts that can work remotely if required.  The only limits are the ones we apply.

V1 rocks - It can't be legal that V2 is this much fun.

Technorati Tags:

Tags:
Categories:

5 comment(s) so far...


Gravatar

Re: PowerShell Remoting

You just came Chanel Replicas across this really cool bumper sticker printing website that offers colorful, custom stickers at great prices. Unfortunately, Chanel Handbags you're just not sure that you want to put Chanel Bags a sticker of any kind on your Prada Handbags car. What reason would you have to do UGG so?

Trust us;Discount UGGs there are plenty of reasons to Prada Replicas smack one of these great stickers on your ride. The Prada Bags first of which is for a cause. UGGs Is there something that you feel particularly strong about? Are you completely against illegal Gucci Replicas immigration? Do you support organ and tissue donation? Are you a gun control advocate? Are you all about owning a firearm? Gucci Handbags These days there are plenty of things to be passionate UGG Boots on Sale about, from wars in foreign countries, to animal adoption. Gucci Bags People from your hometown to places on the opposite side of the country are promoting their causes with bumper sticker printing.UGG Boots

You don't want to let everyone know Louis Vuitton Replicas how you feel about the death penalty. That's okay! People are putting bumper stickers on their Christian Louboutin Shoes on Sale cars for other reasons too. Discount UGG Boots How about advertising? Do you own a business? Louis Vuitton Handbags Do you have a friend who owns a business? What about UGG Boots Outlet your parents? Individuals who own businesses are beginning to realize that it doesn't really make sense to pay for elaborate Louis Vuitton Bags and expensive advertising when you could just advertise on your own vehicle for essentially free. Bumper sticker advertising is not Discount UGG Boots only inexpensive, it's portable. If you're promoting your business from the back window of your car, then people from your house, to the mall, to the Coach Bags Outlet beach where you're planning to go this weekend will see your advertisement.UGG Boots on Sale Talk about Christian Louboutin Outlet reaching a mass market!

What about politics? Are you a Democrat who is against the new Republican congress and you're already dreaming Coach Handbags about campaigning for the future? Come up with a slogan and make it happen! Or, you can Cheap UGG Boots just promote the candidate with whom you most relate. If you're passionate about politics and you want to help your favorite candidate get the word out, a Coach Bags bumper sticker is definitely the way to go. Political stickers are almost as The North Face Outlet prevalent on the roadway as....cars! Christian Louboutin Shoes

Another type of sticker that's seen on Coach Outlet Online the roadways quite frequently is the sports team sticker. Show off your UGG Boots Volunteer Pride or your love for the Baltimore Orioles with a big, orange "T" or an "O" Discount Christian Louboutin Shoes that takes up half of the back window on your SUV. There are sports team stickers available everywhere online. If Cheap Christian Louboutin Shoes you aren't seeing one you love, a custom bumper sticker printing company can certainly produce one for you and it'll Coach Outlet be a bumper sticker you're proud to have on your car. The North Face Jackets

People also put stickers on North Face Jackets their cars for religious and spiritual reasons. From the Jesus fish, to the cross, people Coach Handbags Outlet are praising the Lord in the pew and on their bumper!

On a more somber note, people also use Coach Handbags bumper stickers to remember relatives and friends who have passed away.

If you're UGGs interested in ordering your Coach Bags Outlet own custom bumper sticker, you're making a great decision! Have a seat in front of your computer and visit a bumper sticker printing company's website. You can customize your own sticker Coach Bags or choose one from the thousands they have to offer. Don't just stop at one though! You can order stickers in bulk, which is especially handy if you're using your bumper stickers to promote your small business. Your Coach Outlet sticker order should ship The North Face Jacket within a couple of days and you'll be well on your way to showing off your cause, political affiliation, or favorite sports team! North Face Jacket

By swei on   Friday, October 14, 2011 6:18 AM
Gravatar

Re: PowerShell Remoting

Do you Know Gucci ? It is the symbol of high society and luxury life. All product printed GUCCI will be sold with a very high price. I am love the gucci so much , and i used to buy it from Gucci bags On Sale store.

By linzhi on   Thursday, October 20, 2011 9:08 AM
Gravatar

Re: PowerShell Remoting

Do you Know Gucci ? It is the symbol of high society and luxury life. All product printed GUCCI will be sold with a very high price. I am love the gucci so much , and i used to buy it from Gucci bags On Sale store.

By linzhi on   Thursday, October 20, 2011 9:11 AM
Gravatar

Re: PowerShell Remoting


Do you Know Gucci ? It is the symbol of high society and luxury life. All product printed GUCCI will be sold with a very high price. I am love the gucci so much , and i used to buy it from [url=http://guccibags-onsale.net]Gucci bags On Sale[/url] store.

By linzhi on   Thursday, October 20, 2011 9:11 AM
Gravatar

Re: PowerShell Remoting

Anyone blogging regularly Discount Vibram FiveFingers would love to increase their blog traffic. Targeted web Vibram Five Fingers on Sale traffic is what every webmaster craves. Cheap Christian Louboutin Shoes The process of getting your site or blog noticed by Vibram FiveFingers on Sale the search engines is often referred to as UGG SEO which stands for search engine Discount Vibram Five Fingers optimization.

When it comes to SEO there are 100's Vibram Five Fingers Outlet of methods, with in those 100's of methods Discount Christian Louboutin Shoes there are probably 1000's of strategies. The most popular method of SEO would have to be Vibram FiveFingers Link Building. Building quality Christian Louboutin Shoes on Sale one way links back to your site or blog Vibram FiveFingers Outlet can be very effective in getting UGGs the search engines attention, when done Vibram Five Fingers correctly.

I know, not Christian Louboutin Shoes everyone that's Blogging or doing any writing online Cheap UGG Boots for that matter, is doing it for a business purpose, I also know, it's a great hobby. A lot of people write Blue UGG Boots cause they feel they have a knack for it, but unfortunately no one can Christian Louboutin Outlet ever see it because it hasn't been Blue UGG Search Engine Optimized or to be a little more specific, Blue UGGs you need Backlinks. Yes, Backlinks is only part of the equation, but in my honest Red UGG opinion a solid Link Building Strategy can UGG Boots on Sale really get the search engines attention. Red UGG Boots

Think about this, you wouldn't be spending Red UGGs your valuable time working out or exercising if you knew you'd never UGG Gloves get results, so why are you Blogging/Writing, if only a handful of Discount UGGs people ever see it, you might as well just think it for that matter.

You need to get traffic to UGG Boots on Sale your Blogs and Articles if you'd like a chance of monetizing it. You can use UGG Gloves AdSense ad's or promote affiliate products to make some spare cash if your UGG Boots Blog is getting traffic too. It all comes back to traffic, and unless your paying for it, getting traffic is hard work. Building one way Backlinks to your Blog Discount UGG Boots is one of the most popular methods UGG Boots Outlet to increase Blog traffic.

You'd be surprised to know how many UGGs "Bloggers", holding no more than a High School Diploma are "6 Figure Income - Expert Writers" now because some Big- Wig saw something special in their content. Blogging is awesome, I still write at least a post a day. Nothing is Sand UGG Boots worse than pouring your heart into something Sand UGG and getting nothing out of it.

Quick Personal Experience... Sand UGGs

I love the NFL, I know a lot Navy UGG Boots about it and it's fun for me to Green UGGs write about it. When I first started Blogging I couldn't get 10 visitors a day, and it killed me because I knew Navy UGG I had a lot to offer. I knew that anyone that actually Black UGG Boots knew football would really enjoy my Blog, but I Discount UGG Boots couldn't get it to anyone. Finally I read a report about Green UGG Boots Link Building strategies and I got to work. After about Green UGG 6 weeks of blood sweat and tears and building Backlinks nearly 24/7 the traffic started to roll in. Now, I enjoy writing about the NFL weekly and it results in a steady income Black UGGs for me. Is it making me rich, no far from it, just knowing my writing is what I thought it Navy UGGs was and people are willing to pay me UGG Boots for it, has been very gratifying. Black UGG

By swei on   Thursday, December 15, 2011 7:34 AM
 
Blogs
  
Search Blogs
  
Archives
  
   
footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
footer