• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

Powershell code

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
Kay
Asked:
Kay
  • 2
  • 2
  • 2
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
QlemoC++ DeveloperCommented:
[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
 
KayAuthor Commented:
these codes are from the .net framework right?
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
yes, exactly. the .net framework is integral part of the windows installation ...
0
 
KayAuthor Commented:
I c, so if learn .net I can use those codes in powershell?
0
 
QlemoC++ DeveloperCommented:
It is very similar to what you would have to do in C# or VB (?), so the answer should be "yes".
0

Featured Post

A Cyber Security RX to Protect Your Organization

Join us on December 13th for a webinar to learn how medical providers can defend against malware with a cyber security "Rx" that supports a healthy technology adoption plan for every healthcare organization.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now