Local versus remote processing in VB.NET

Printing Data Matrix 2d barcode in VB.NET Local versus remote processing

10.5.2 Local versus remote processing
DataMatrix Maker In VB.NET
Using Barcode printer for .NET Control to generate, create ECC200 image in .NET framework applications.
www.OnBarcode.com
ECC200 Scanner In VB.NET
Using Barcode scanner for .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Here s my original example again:
Draw 2D Barcode In VB.NET
Using Barcode drawer for .NET Control to generate, create Matrix image in .NET framework applications.
www.OnBarcode.com
Printing PDF 417 In Visual Basic .NET
Using Barcode drawer for VS .NET Control to generate, create PDF-417 2d barcode image in VS .NET applications.
www.OnBarcode.com
Invoke-Command -computerName Server-R2,Server-DC4,Server12 -command { Get-EventLog Security -newest 200 | Where { $_.EventID -eq 1212 }}
UCC - 12 Creation In Visual Basic .NET
Using Barcode generator for .NET framework Control to generate, create GS1 128 image in .NET framework applications.
www.OnBarcode.com
Barcode Drawer In VB.NET
Using Barcode generator for VS .NET Control to generate, create Barcode image in VS .NET applications.
www.OnBarcode.com
Now, compare it to this alternative:
Paint Quick Response Code In Visual Basic .NET
Using Barcode creation for VS .NET Control to generate, create QR Code image in .NET framework applications.
www.OnBarcode.com
Uniform Symbology Specification Codabar Encoder In Visual Basic .NET
Using Barcode printer for VS .NET Control to generate, create Code-27 image in Visual Studio .NET applications.
www.OnBarcode.com
Invoke-Command -computerName Server-R2,Server-DC4,Server12 -command { Get-EventLog Security -newest 200 } | Where { $_.EventID -eq 1212 }
Making Data Matrix 2d Barcode In None
Using Barcode creator for Online Control to generate, create ECC200 image in Online applications.
www.OnBarcode.com
Draw DataMatrix In None
Using Barcode creation for Microsoft Excel Control to generate, create DataMatrix image in Office Excel applications.
www.OnBarcode.com
The differences are subtle. Actually, there s only one difference: I moved one of those curly braces. In the second version, only Get-EventLog is being invoked remotely. All of the results generated by Get-EventLog will be serialized and sent to my computer, where they ll be deserialized into objects and then piped to Where and filtered. The second version of the command is less efficient, because a lot of unnecessary data is being transmitted across the network, and my one computer is having to filter the results from three computers, rather than those three computers filtering their own results for me. The second version, in other words, is a bad idea.
Making EAN13 In Java
Using Barcode creator for Eclipse BIRT Control to generate, create GS1 - 13 image in BIRT reports applications.
www.OnBarcode.com
Make UPC Symbol In Java
Using Barcode encoder for Java Control to generate, create UPCA image in Java applications.
www.OnBarcode.com
But wait, there s more
Code128 Generator In Java
Using Barcode printer for Android Control to generate, create Code 128 Code Set C image in Android applications.
www.OnBarcode.com
Scan UPC Symbol In Visual C#
Using Barcode scanner for .NET framework Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
Let s look at two versions of another command. Here s the first:
Reading Code39 In Java
Using Barcode decoder for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Making 1D In .NET
Using Barcode generation for VS .NET Control to generate, create 1D image in Visual Studio .NET applications.
www.OnBarcode.com
Invoke-Command -computerName Server-R2 -command { Get-Process -name Notepad } | Stop-Process
PDF-417 2d Barcode Generator In None
Using Barcode maker for Font Control to generate, create PDF417 image in Font applications.
www.OnBarcode.com
Print Code 39 Extended In None
Using Barcode creation for Microsoft Word Control to generate, create Code 3/9 image in Microsoft Word applications.
www.OnBarcode.com
Here s the second version:
Generating GTIN - 13 In Java
Using Barcode creator for Java Control to generate, create EAN-13 image in Java applications.
www.OnBarcode.com
Generating Denso QR Bar Code In None
Using Barcode printer for Microsoft Word Control to generate, create QR Code image in Word applications.
www.OnBarcode.com
Invoke-Command -computerName Server-R2 -command { Get-Process -name Notepad | Stop-Process }
Once again, the only difference between these two is the placement of a curly brace. In this example, however, the first version of the command won t work. Look carefully: I m sending Get-Process -name Notepad to the remote computer. The remote computer retrieves the specified process, serializes it into XML, and sends it to me across the network. My computer receives that XML, deserializes it back into an object, and pipes it to Stop-Process. The problem is that the deserialized XML doesn t contain enough information for my computer to realize that the process came from a remote machine. Instead, my computer will try to stop the Notepad process running locally, which isn t what I wanted at all. The moral of the story is to always complete as much of your processing on the remote computer as possible. The only thing you should expect to do with the results of Invoke-Command is to display them or store them, as a report or data file or something. The second version of my command follows that advice: what s being sent to the remote computer is Get-Process -name Notepad | Stop-Process, so the entire command both getting the process and stopping it happens on the remote computer. Because Stop-Process doesn t normally produce any output, there won t be any objects to serialize and send to me, so I won t see anything on my local console. But the command will do what I want: stop the Notepad process on the remote computer, not on my local machine. Whenever I use Invoke-Command, I always look at the commands after it. If I see commands for formatting, or for exporting data, I m fine, because it s okay to do those things with the results of Invoke-Command. But if Invoke-Command is followed by action cmdlets ones that start, stop, set, change, or do something else then I sit back and try to think about what I m doing. Ideally, I want all of those actions to happen on the remote computer, not on my local computer.
10.6 But wait, there s more
These examples have all used ad hoc remoting connections, meaning that I specified computer names. If you re going to be reconnecting to the same computer (or computers) several times within a short period of time, you can create reusable, persistent connections to use instead. We ll cover that technique in chapter 18. I should also acknowledge that not every company is going to allow PowerShell remoting to be enabled at least, not right away. Companies with extremely restrictive
Copyright © OnBarcode.com . All rights reserved.