Solved

Powershell code

Posted on 2014-03-07
6
227 Views
Last Modified: 2014-03-10
I came across these type of code on a powershell script

[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")

System.Windows.Forms.Form

System.Drawing.Size(1069, 809)

System.Windows.Forms.Label

what type of codes are they and where I can learn more about them?
0
Comment
Question by:Kay
  • 2
  • 2
  • 2
6 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39912274
I presume you come from here:
http://technet.microsoft.com/en-us/library/ff730941.aspx

this is some code to draw some application windows from script, eventually dynamically etc.
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 39912379
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

Open in new window

is the old way of loading a .NET assembly. With PowerShell 2.0 and above you usually say
Add-Type -Assembly System.Windows.Forms

Open in new window

instead.
After loading an assembly you are able to use the classes defined in that assembly. In this particular case, as Guy stated correctly, it's code to create a Windows dialog with some labels and  buttons and the like, set the size and position etc, in short all the stuff you have to do to build a Windows Form "manually".
0
 

Author Comment

by:Kay
ID: 39912449
these codes are from the .net framework right?
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
ID: 39912466
yes, exactly. the .net framework is integral part of the windows installation ...
0
 

Author Comment

by:Kay
ID: 39912501
I c, so if learn .net I can use those codes in powershell?
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 250 total points
ID: 39912591
It is very similar to what you would have to do in C# or VB (?), so the answer should be "yes".
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Synchronize a new Active Directory domain with an existing Office 365 tenant
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question