Solved

Powershell code

Posted on 2014-03-07
6
221 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 142

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 68

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 142

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 68

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now