12 functional posts of Windows powershell)

Source: Internet
Author: User
From: http://www.stcore.com/windows/2006-11/1164038495d114137.html

Windows powershell 1.0 has been released. on Microsoft Windows vistablog, developers listed windows
Powershell provides 12 cool functions:

Answer powershell: the original development code of powershell was monad, which was originally intended to replace the command line tool in windows. However, Microsoft later said it was only a technical expansion. With powershell, the administrator can do anything in the graphic interface. Windows
Powershell 1.0 can run on Windows XP SP2, Windows Server 2003, and Windows Vista.

1. built-in cmdlets (that is, "commandlets ")

All cmdlets in powershell allow the following terms: Get-service, get-process, stop-service,

2. Powerful wildcards and operation objects

To obtain the services starting with W and their dependent services, you only need to enter:

PS> Get-service w * format-list displayname, dependentservices

3. Test the command before making a mistake

Windows powershell has a unique function: Whatif
, You can tell you the command execution result without executing the command. For example:

PS> stop-service W3 *-Whatif

Get copy

Powershell can start and end copies of all commands. It can easily test commands in scripts and save them at the same time.

Start-transcript-path C: demodfoshow.txt

PS> stop-Transcript

5. Publish a Windows dialog from the command line

Because Windows powershell bit objects are optimized
The following command tells your Vista machine to publish the "Windows Vista and powershell" string.

PS> $ spvoice = new-object-com "SAPI. spvoice"

$ Spvoice. Speak ("Windows Vista and powershell ")

6. Use Windows
Powershell accesses applications such as Windows Media Player 11Program

PS> $ band ="

PS> $ player = new-object-com wmplayer. ocx

$ Playlist = $ player. mediacollection. getbyauthor ($ band)

$ Player. openplayer ($ playlist. Item (0). sourceurl)

7. Windows
Powershell as a command line storage Calculator

Powershell can complete basic computing work

PS> 2*2

However, Windows powershell can also quickly solve storage problems, for example, how many 700mb CD is required to back up 11 GB of data.

PS> 11 Gbit/s/700 mb

How many 320 GB storage is required to back up each 425 GB, with a total of Vista desktops?

(320 GB * 425)/1000 GB

8. powershell is used for calendar computing.

Calculate the number of days to the New Year:

PS> ([datetime] "1/1/2007"-[datetime]: Now). Days

Returns the number of certain types of files on the machine.

Vista has many types of event records and group policy files. The following command returns the number of VBScript, bat, and powershell scripts in the current directory and Its subdirectories:

PS> Dir-include *. vbs, *. ps1, *. Bat-recurse group-Object

10. Collect Windows system assessment tool data from the command line

PS> Get-wmiobject win32_winsat format-Table _ server, * score

PS> Get-wmiobject win32_winsat select * score
Out-chart-title "system assessment scores by powergadgets"

Configure UAC (User Account Control)

PS> set-itemproperty-Path
HKLM: softwaremicrosoftwindowscurrentversionpoliciessystem-name
Consentpromptbehavioradmin-value 0

12. Manage bitlocker

$ Drives = Get-wmiobject-namespace rootcimv2securitymicrosoftvolumeencryption
-Class win32_encryptablevolume

PS> $ drives format-table
Driveletter, persistentvolumeid-autosize

PS> $ bitlockdrive =
$ Drives [0]

PS> $ bitlockdrive. getprotectionstatus ()

$ Bitlockdrive. disablekeyprotectors ()

$ Bitlockdrive. enablekeyprotectors ()

Additional resources:

Windows powershell
scripting with Windows powershell

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.