Skip to content

Commit 91d0af9

Browse files
committed
replacing unexpected characters â€
1 parent 7d94a1f commit 91d0af9

15 files changed

+15
-1875
lines changed
Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1 @@
1-
---
2-
ms.date: 2017-06-05
3-
keywords: powershell,cmdlet
4-
title: The ISEMenuItem Object
5-
ms.assetid: a16660bd-0aee-46fd-ac17-3f022165d089
6-
---
7-
8-
# The ISEMenuItem Object
9-
An **ISEMenuItem** object is an instance of the Microsoft.PowerShell.Host.ISE.ISEMenuItem class. All menu objects on the **Add-ons** menu are instances of the **Microsoft.PowerShell.Host.ISE.ISEMenuItem** class.
10-
11-
## Properties
12-
13-
### DisplayName
14-
Supported in Windows PowerShell ISE 2.0 and later.
15-
16-
The read-only property that gets the display name of the menu item.
17-
18-
```
19-
# Get the display name of the Add-ons menu item
20-
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear()
21-
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P")
22-
$psISE.CurrentPowerShellTab.AddOnsMenu.DisplayName
23-
24-
```
25-
26-
### Action
27-
Supported in Windows PowerShell ISE 2.0 and later.
28-
29-
The read-only property that gets the block of script. It invokes the action when you click the menu item.
30-
31-
```
32-
# Get the action associated with the first submenu item.
33-
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear()
34-
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P")
35-
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Action
36-
37-
# Invoke the script associated with the first submenu item
38-
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Action.Invoke()
39-
```
40-
41-
### Shortcut
42-
Supported in Windows PowerShell ISE 2.0 and later.
43-
44-
The read-only property that gets the Windows input keyboard shortcut for the menu item.
45-
46-
```
47-
# Get the shortcut for the first submenu item.
48-
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear()
49-
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P")
50-
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Shortcut
51-
```
52-
53-
### Submenus
54-
Supported in Windows PowerShell ISE 2.0 and later.
55-
56-
The read-only property that gets the [list of submenus](The-ISEMenuItemCollection-Object.md) of the menu item.
57-
58-
```
59-
# List the submenus of the Add-ons menu
60-
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear()
61-
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P")
62-
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus
63-
```
64-
65-
## Scripting example
66-
To better understand the use of the Add-ons menu and its scriptable properties, read through the following scripting example.
67-
68-
```
69-
70-
# This is a scripting example that shows the use of the Add-ons menu.
71-
# Clear the Add-ons menu if any entries currently exist
72-
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear()
73-
74-
# Add an Add-ons menu item with an shortcut and fast access key.
75-
# Note the use of “_” as opposed to the “&” for mapping to the fast access key letter for the menu item.
76-
$menuAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P")
77-
# Add a nested menu - a parent and a child submenu item.
78-
$parentAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("Parent",$null,$null)
79-
$parentAdded.SubMenus.Add("_Dir",{dir},"Alt+D")
80-
81-
```
82-
83-
## See Also
84-
- [The ISEMenuItemCollection Object](The-ISEMenuItemCollection-Object.md)
85-
- [The Windows PowerShell ISE Scripting Object Model](The-Windows-PowerShell-ISE-Scripting-Object-Model.md)
86-
- [Windows PowerShell ISE Object Model Reference](Windows-PowerShell-ISE-Object-Model-Reference.md)
87-
- [The ISE Object Model Hierarchy](The-ISE-Object-Model-Hierarchy.md)
1+
--- ms.date: 2017-06-05 keywords: powershell,cmdlet title: The ISEMenuItem Object ms.assetid: a16660bd-0aee-46fd-ac17-3f022165d089 --- # The ISEMenuItem Object An **ISEMenuItem** object is an instance of the Microsoft.PowerShell.Host.ISE.ISEMenuItem class. All menu objects on the **Add-ons** menu are instances of the **Microsoft.PowerShell.Host.ISE.ISEMenuItem** class. ## Properties ### DisplayName Supported in Windows PowerShell ISE 2.0 and later. The read-only property that gets the display name of the menu item. ``` # Get the display name of the Add-ons menu item $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear() $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P") $psISE.CurrentPowerShellTab.AddOnsMenu.DisplayName ``` ### Action Supported in Windows PowerShell ISE 2.0 and later. The read-only property that gets the block of script. It invokes the action when you click the menu item. ``` # Get the action associated with the first submenu item. $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear() $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P") $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Action # Invoke the script associated with the first submenu item $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Action.Invoke() ``` ### Shortcut Supported in Windows PowerShell ISE 2.0 and later. The read-only property that gets the Windows input keyboard shortcut for the menu item. ``` # Get the shortcut for the first submenu item. $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear() $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P") $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Shortcut ``` ### Submenus Supported in Windows PowerShell ISE 2.0 and later. The read-only property that gets the [list of submenus](The-ISEMenuItemCollection-Object.md) of the menu item. ``` # List the submenus of the Add-ons menu $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear() $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P") $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus ``` ## Scripting example To better understand the use of the Add-ons menu and its scriptable properties, read through the following scripting example. ``` # This is a scripting example that shows the use of the Add-ons menu. # Clear the Add-ons menu if any entries currently exist $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear() # Add an Add-ons menu item with an shortcut and fast access key. # Note the use of '?_'? as opposed to the '?&'? for mapping to the fast access key letter for the menu item. $menuAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P") # Add a nested menu - a parent and a child submenu item. $parentAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("Parent",$null,$null) $parentAdded.SubMenus.Add("_Dir",{dir},"Alt+D") ``` ## See Also - [The ISEMenuItemCollection Object](The-ISEMenuItemCollection-Object.md) - [The Windows PowerShell ISE Scripting Object Model](The-Windows-PowerShell-ISE-Scripting-Object-Model.md) - [Windows PowerShell ISE Object Model Reference](Windows-PowerShell-ISE-Object-Model-Reference.md) - [The ISE Object Model Hierarchy](The-ISE-Object-Model-Hierarchy.md)
Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1 @@
1-
---
2-
ms.date: 2017-06-05
3-
keywords: powershell,cmdlet
4-
title: The ISESnippetCollection Object
5-
ms.assetid: ae974955-4282-4cbc-8c42-0fff1904ef32
6-
---
7-
8-
# The ISESnippetCollection Object
9-
The **ISESnippetCollection** object is a collection of **ISESnippet** objects. The files collection that is associated with a **PowerShellTab** object is a member of this class. An example is the **$psISE.CurrentPowerShellTab.Files** collection.
10-
11-
## Methods
12-
13-
### Load\( FilePathName \)
14-
Supported in Windows PowerShell ISE 3.0 and later, and not present in earlier versions.
15-
16-
Loads a .snippets.ps1xml file that contains user-defined snippets. The easiest way to create snippets is to use the New-IseSnippet cmdlet, which automatically stores them in your profile folder so that they are loaded every time that you start Windows PowerShell ISE.
17-
18-
**FilePathName** - String
19-
The path and file name to a .snippets.ps1xml file that contains snippet definitions.
20-
21-
```
22-
# Loads a custom snippet file into the current PowerShell tab.
23-
$SnipFile = Join-Path ( Split-Path $profile) “Snippets\MySnips.snippets.ps1xml” $psISE.CurrentPowerShellTab.Snippets.Add($SnipPath)
24-
25-
```
26-
27-
## See Also
28-
- [The ISESnippetObject](The-ISESnippetObject.md)
29-
- [The Windows PowerShell ISE Scripting Object Model](The-Windows-PowerShell-ISE-Scripting-Object-Model.md)
30-
- [Windows PowerShell ISE Object Model Reference](Windows-PowerShell-ISE-Object-Model-Reference.md)
31-
- [The ISE Object Model Hierarchy](The-ISE-Object-Model-Hierarchy.md)
32-
33-
1+
--- ms.date: 2017-06-05 keywords: powershell,cmdlet title: The ISESnippetCollection Object ms.assetid: ae974955-4282-4cbc-8c42-0fff1904ef32 --- # The ISESnippetCollection Object The **ISESnippetCollection** object is a collection of **ISESnippet** objects. The files collection that is associated with a **PowerShellTab** object is a member of this class. An example is the **$psISE.CurrentPowerShellTab.Files** collection. ## Methods ### Load\( FilePathName \) Supported in Windows PowerShell ISE 3.0 and later, and not present in earlier versions. Loads a .snippets.ps1xml file that contains user-defined snippets. The easiest way to create snippets is to use the New-IseSnippet cmdlet, which automatically stores them in your profile folder so that they are loaded every time that you start Windows PowerShell ISE. **FilePathName** - String The path and file name to a .snippets.ps1xml file that contains snippet definitions. ``` # Loads a custom snippet file into the current PowerShell tab. $SnipFile = Join-Path ( Split-Path $profile) '?Snippets\MySnips.snippets.ps1xml'? $psISE.CurrentPowerShellTab.Snippets.Add($SnipPath) ``` ## See Also - [The ISESnippetObject](The-ISESnippetObject.md) - [The Windows PowerShell ISE Scripting Object Model](The-Windows-PowerShell-ISE-Scripting-Object-Model.md) - [Windows PowerShell ISE Object Model Reference](Windows-PowerShell-ISE-Object-Model-Reference.md) - [The ISE Object Model Hierarchy](The-ISE-Object-Model-Hierarchy.md)
Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1 @@
1-
---
2-
ms.date: 2017-06-05
3-
keywords: powershell,cmdlet
4-
title: Changing Computer State
5-
ms.assetid: 8093268b-27f8-4a49-8871-142c5cc33f01
6-
---
7-
8-
# Changing Computer State
9-
To reset a computer in Windows PowerShell, use either a standard command-line tool or a WMI class. Although you are using Windows PowerShell only to run the tool, learning how to change a computer's power state in Windows PowerShell illustrates some of the important details about working with external tools in Windows PowerShell.
10-
11-
### Locking a Computer
12-
The only way to lock a computer directly with the standard available tools is to call the **LockWorkstation()** function in **user32.dll**:
13-
14-
```
15-
rundll32.exe user32.dll,LockWorkStation
16-
```
17-
18-
This command immediately locks the workstation. It uses *rundll32.exe*, which runs Windows DLLs (and saves their libraries for repeated use) to run user32.dll, a library of Windows management functions.
19-
20-
When you lock a workstation while Fast User Switching is enabled, such as on Windows XP, the computer displays the user logon screen rather than starting the current user's screensaver.
21-
22-
To shut down particular sessions on a Terminal Server, use the **tsshutdn.exe** command-line tool.
23-
24-
### Logging Off the Current Session
25-
You can use several different techniques to log off of a session on the local system. The simplest way is to use the Remote Desktop/Terminal Services command-line tool, **logoff.exe** (For details, at the Windows PowerShell prompt, type **logoff /?**). To log off the current active session, type **logoff** with no arguments.
26-
27-
You can also use the **shutdown.exe** tool with its logoff option:
28-
29-
```
30-
shutdown.exe -l
31-
```
32-
33-
A third option is to use WMI. The Win32_OperatingSystem class has a Win32Shutdown method. Invoking the method with the 0 flag initiates logoff:
34-
35-
```
36-
(Get-WmiObject -Class Win32_OperatingSystem -ComputerName .).Win32Shutdown(0)
37-
```
38-
39-
For more information, and to find other features of the Win32Shutdown method, see "Win32Shutdown Method of the Win32_OperatingSystem Class" in MSDN.
40-
41-
### Shutting Down or Restarting a Computer
42-
Shutting down and restarting computers are generally the same types of task. Tools that shut down a computer will generally restart it as well—and vice versa. There are two straightforward options for restarting a computer from Windows PowerShell. Use either Tsshutdn.exe or Shutdown.exe with appropriate arguments. You can get detailed usage information from **tsshutdn.exe /?** or **shutdown.exe /?**.
43-
44-
You can also perform shutdown and restart operations by using **Win32_OperatingSystem** directly from Windows PowerShell as well.
45-
46-
To shut down the computer, use the Win32Shutdown method with the **1** flag.
47-
48-
```
49-
(Get-WmiObject -Class Win32_OperatingSystem -ComputerName .).Win32Shutdown(1)
50-
```
51-
52-
To restart the operating system, use the Win32Shutdown method with the **2** flag.
53-
54-
```
55-
(Get-WmiObject -Class Win32_OperatingSystem -ComputerName .).Win32Shutdown(2)
56-
```
57-
1+
--- ms.date: 2017-06-05 keywords: powershell,cmdlet title: Changing Computer State ms.assetid: 8093268b-27f8-4a49-8871-142c5cc33f01 --- # Changing Computer State To reset a computer in Windows PowerShell, use either a standard command-line tool or a WMI class. Although you are using Windows PowerShell only to run the tool, learning how to change a computer's power state in Windows PowerShell illustrates some of the important details about working with external tools in Windows PowerShell. ### Locking a Computer The only way to lock a computer directly with the standard available tools is to call the **LockWorkstation()** function in **user32.dll**: ``` rundll32.exe user32.dll,LockWorkStation ``` This command immediately locks the workstation. It uses *rundll32.exe*, which runs Windows DLLs (and saves their libraries for repeated use) to run user32.dll, a library of Windows management functions. When you lock a workstation while Fast User Switching is enabled, such as on Windows??XP, the computer displays the user logon screen rather than starting the current user's screensaver. To shut down particular sessions on a Terminal Server, use the **tsshutdn.exe** command-line tool. ### Logging Off the Current Session You can use several different techniques to log off of a session on the local system. The simplest way is to use the Remote Desktop/Terminal Services command-line tool, **logoff.exe** (For details, at the Windows PowerShell prompt, type **logoff /?**). To log off the current active session, type **logoff** with no arguments. You can also use the **shutdown.exe** tool with its logoff option: ``` shutdown.exe -l ``` A third option is to use WMI. The Win32_OperatingSystem class has a Win32Shutdown method. Invoking the method with the 0 flag initiates logoff: ``` (Get-WmiObject -Class Win32_OperatingSystem -ComputerName .).Win32Shutdown(0) ``` For more information, and to find other features of the Win32Shutdown method, see "Win32Shutdown Method of the Win32_OperatingSystem Class" in MSDN. ### Shutting Down or Restarting a Computer Shutting down and restarting computers are generally the same types of task. Tools that shut down a computer will generally restart it as well'?and vice versa. There are two straightforward options for restarting a computer from Windows PowerShell. Use either Tsshutdn.exe or Shutdown.exe with appropriate arguments. You can get detailed usage information from **tsshutdn.exe /?** or **shutdown.exe /?**. You can also perform shutdown and restart operations by using **Win32_OperatingSystem** directly from Windows PowerShell as well. To shut down the computer, use the Win32Shutdown method with the **1** flag. ``` (Get-WmiObject -Class Win32_OperatingSystem -ComputerName .).Win32Shutdown(1) ``` To restart the operating system, use the Win32Shutdown method with the **2** flag. ``` (Get-WmiObject -Class Win32_OperatingSystem -ComputerName .).Win32Shutdown(2) ```

0 commit comments

Comments
 (0)