diff --git a/dsc/configurations/reboot-a-node.md b/dsc/configurations/reboot-a-node.md index 9a3cff99e744..f2f14ad8e32e 100644 --- a/dsc/configurations/reboot-a-node.md +++ b/dsc/configurations/reboot-a-node.md @@ -1,5 +1,5 @@ --- -ms.date: 1/17/2019 +ms.date: 01/17/2019 keywords: dsc,powershell,configuration,setup title: Reboot a Node --- diff --git a/reference/docs-conceptual/samples/Creating-Get-WinEvent-queries-with-FilterHashtable.md b/reference/docs-conceptual/samples/Creating-Get-WinEvent-queries-with-FilterHashtable.md index 56caf19c586e..8f386993c72a 100644 --- a/reference/docs-conceptual/samples/Creating-Get-WinEvent-queries-with-FilterHashtable.md +++ b/reference/docs-conceptual/samples/Creating-Get-WinEvent-queries-with-FilterHashtable.md @@ -1,5 +1,5 @@ --- -ms.date: 3/18/2019 +ms.date: 03/18/2019 title: Creating Get-WinEvent queries with FilterHashtable --- diff --git a/reference/docs-conceptual/samples/Decode-PowerShell-Command-from-a-Running-Process.md b/reference/docs-conceptual/samples/Decode-PowerShell-Command-from-a-Running-Process.md index fd1ac10ed2df..300d987d4163 100644 --- a/reference/docs-conceptual/samples/Decode-PowerShell-Command-from-a-Running-Process.md +++ b/reference/docs-conceptual/samples/Decode-PowerShell-Command-from-a-Running-Process.md @@ -33,7 +33,7 @@ powershell.exe -Command { ## View the process The body of the command which PowerShell is executing is stored in the **CommandLine** property -of the [Win32_Process][] class. If the command is an [encoded command][], the **CommandLine** +of the [Win32_Process][] class. If the command is an encoded command, the **CommandLine** property contains the string "EncodedCommand". Using this information, the encoded command can be de-obfuscated via the following process. @@ -114,4 +114,3 @@ DecodedCommand : [Task Scheduler]: /windows/desktop/TaskSchd/task-scheduler-start-page [SQL Server Agent]: /sql/ssms/agent/sql-server-agent [Win32_Process]: /windows/desktop/CIMWin32Prov/win32-process -[encoded command]: /powershell/scripting/core-powershell/console/powershell.exe-command-line-help#-encodedcommand- diff --git a/reference/docs-conceptual/samples/Working-with-Objects.md b/reference/docs-conceptual/samples/Working-with-Objects.md deleted file mode 100644 index 669da031957b..000000000000 --- a/reference/docs-conceptual/samples/Working-with-Objects.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -ms.date: 06/05/2017 -keywords: powershell,cmdlet -title: Working with Objects -ms.assetid: 7ecc94a4-015c-4459-ae58-85289ea09030 ---- -# Working with Objects - -We have discussed how Windows PowerShell uses objects to transfer data between cmdlets, and demonstrated a few ways to view detailed information about objects by using Get-Member and Format cmdlets to view particular properties of objects. - -The power of objects is that they provide you with access to a lot of complex data, and it is already correlated. With some simple techniques you can further manipulate objects to do even more work. We are going to look at some specific types of objects and ways you can manipulate them in this chapter. \ No newline at end of file diff --git a/wmf/whats-new/class-overview.md b/wmf/whats-new/class-overview.md index f11c29be6380..bd02cef197c3 100644 --- a/wmf/whats-new/class-overview.md +++ b/wmf/whats-new/class-overview.md @@ -20,7 +20,7 @@ PowerShell artifacts (such as DSC resources), and accelerate coverage of managem - Debug types by using the PowerShell language - Generate and handle exceptions by using formal mechanisms, and at the right level -# Declare Base Class +## Declare Base Class You can declare a PowerShell class as a base type for another PowerShell class. @@ -53,7 +53,7 @@ $list.Add(100) $list[0] # return 100 ``` -# Call Base Class Constructor +### Call Base Class Constructor To call a base class constructor from a subclass, use the keyword **base**: @@ -85,7 +85,7 @@ class C : B } ``` -# Call Base Class Method +### Call Base Class Method You can override existing methods in subclasses. To do this, declare methods by using the same name and signature: @@ -137,7 +137,7 @@ $list.Add(100) $list[0] # return 200 ``` -# Declare Implemented Interface +### Declare Implemented Interface You can declare implemented interfaces after base types, or immediately after a colon (:), if there is no base type specified. Separate all type names by using commas. It's similar to C# syntax. @@ -160,11 +160,11 @@ class MyComparableBar : bar, system.IComparable } ``` -# New language features in PowerShell 5.0 +## New language features in PowerShell 5.0 PowerShell 5.0 introduces the following new language elements in PowerShell: -## Class keyword +### Class keyword The `class` keyword defines a new class. This is a true .NET Framework type. Class members are public, but only public within the module scope. You can't refer to the type name as a string (for @@ -178,7 +178,7 @@ class MyClass } ``` -## Enum keyword and enumerations +### Enum keyword and enumerations Support for the `enum` keyword has been added, which uses newline as the delimiter. Currently, you cannot define an enumerator in terms of itself. However, you can initialize an enum in terms of @@ -212,12 +212,12 @@ enum SomeEnum { Max = 42 } enum OtherEnum { Max = [SomeEnum]::Max + 1 } ``` -## Import-DscResource +### Import-DscResource `Import-DscResource` is now a true dynamic keyword. PowerShell parses the specified module's root module, searching for classes that contain the **DscResource** attribute. -## ImplementingAssembly +### ImplementingAssembly A new field, **ImplementingAssembly**, has been added to **ModuleInfo**. It is set to the dynamic assembly created for a script module if the script defines classes, or the loaded assembly for @@ -247,7 +247,7 @@ $s = "hello" All members are public. -## Constructors and instantiation +### Constructors and instantiation PowerShell classes can have constructors. They have the same name as their class. Constructors can be overloaded. Static constructors are supported. Properties with initialization expressions are @@ -256,7 +256,7 @@ body of a static constructor, and instance properties are initialized before the non-static constructor. Currently, there is no syntax for calling a constructor from another constructor (like the C\# syntax ": this()"). The workaround is to define a common `Init()` method. -### Creating instances +#### Creating instances > [!NOTE] > In PowerShell 5.0, `New-Object` does not work with classes defined in PowerShell. Also, the type @@ -288,7 +288,7 @@ The pseudo-static method `new()` works with .NET types, as shown in the followin [hashtable]::new() ``` -### Discovering constructors +#### Discovering constructors You can now see constructor overloads with `Get-Member`, or as shown in this example: @@ -304,7 +304,7 @@ hashtable new(int capacity, float loadFactor) `Get-Member -Static` lists constructors, so you can view overloads like any other method. The performance of this syntax is also considerably faster than `New-Object`. -## Methods +### Methods A PowerShell class method is implemented as a **ScriptBlock** that has only an end block. All methods are public. The following shows an example of defining a method named **DoSomething**. @@ -329,7 +329,7 @@ $b.DoSomething(42) Overloaded methods are also supported. -## Properties +### Properties All properties are public. Properties require either a newline or semicolon. If no object type is specified, the property type is object. @@ -337,7 +337,7 @@ specified, the property type is object. Properties that use validation or argument transformation attributes (like `[ValidateSet("aaa")]`) work as expected. -## Hidden +### Hidden A new keyword, `Hidden`, has been added. `Hidden` can be applied to properties and methods (including constructors). @@ -349,17 +349,17 @@ the completion occurs in the class defining the hidden member. A new attribute, **System.Management.Automation.HiddenAttribute** has been added so that C\# code can have the same semantics within PowerShell. -## Return types +### Return types Return type is a contract. The return value is converted to the expected type. If no return type is specified, the return type is **void**. There is no streaming of objects. Objects cannot be written to the pipeline either intentionally or by accident. -## Attributes +### Attributes Two new attributes, **DscResource** and **DscProperty** have been added. -## Lexical scoping of variables +### Lexical scoping of variables The following shows an example of how lexical scoping works in this release.