When we save the execution result of a command to a variable, we might think that the variable is stored in plain text.However, in fact PowerShell will save the text as an element in each row as an array. If the return value of a command has more than one result, PowerShell automatically stores the result as an array.
PS c:powershell> $IPcfg =ipconfig
PS c:powershell> $IPcfg
1 工欲善其事, its prerequisite. This article uses the Windows Update PowerShell Module, the PowerShell Cmdlet, so you need to go to the Web to download it first.
2 The Pswindowsupdate folder that is extracted from the downloaded ZIP package is copied to the following directory:
C:windowssystem32windowspowershe
Win7 built-in PowerShell is 2.0, now obviously outdated, but win system software update, need to solve the dependency problem, so, follow the steps below to install.1. Install the full installation version of Microsoft. NET Framework 4.0 (Dotnetfx40_full_x86_x64.exe), or install the Microsoft. NET Framework 4.5 of the Full installation version (Dotnetfx45_full_x86_x64.exe).2. Install the 6.1 kernel version
above, 3 processes (Acrord32,acrord32,prevhost) have been closed in the before and after periods, and 2 processes have been opened (Notepad,notepad).
Check for changes in objects
Compare-object does not only compare the addition and decrease of objects in an object group, it can also compare the property changes of each object because it has a parameter-property.
PS c:powershell> get-service wsearch
Status Name DisplayName
------
Brief descriptionIn Windows PowerShell, aliases are alternative names for cmdlets or other commands.
Detailed descriptionAliases are cmdlet or commands (for example: functions, scripts, files, executables.) Alternative name, or a nickname. You can use aliases where commands are used.
The name of the cmdlet is made up of a verb and a noun whose function is clear to the user. But it is also troublesome for
First step: Make template Vhdx file (slightly); second step: Make initialization system script (auto set IP, GW, etc.); Place the following 2 scripts in the C:\Windows\Setup\Scripts directory in the template VHDX: 1th script: firstrun.ps1# Gets the computer name $vmname=hostname# the IP address based on the computer name 6-bit [int] $IP 1= $VMname. Substring ($VMname. length-6,3) [int] $IP
Windows azure platform articles
Why modify the subscription name?
There are two main reasons:
(1) A problem was found recently. The default subscription name of azure for 21 vianet O M in China is Chinese, for example, "trial account for enterprise customers.
However, in an English operating system, when you use a subscription selected by powershell, the Chinese subscription name will become garbled.
(
1. telnet to Window server using SSHMost of the methods found online are freesshd or copsshd tools.The way to do this is to download the installation files and install them on the server side:Start and setting as a service after installation is completeTo set the port settings user:Start the server to connect using SSHBut there will be garbled ...2. The second approach is to connect remotely using PowerShell
Powershell updates Nagios Windows Client
Beans found on a newly configured Nagios server today that the Windows Server's memory check still uses check_nt, and check_nt checks the sum of physical memory and virtual memory; I only need to check the physical memory, so I need to change it to check_nrpe. The configuration on the Nagios server is not mentioned much. d
Most people may have used the VBS to read the Windows Product key in the VBS script, the VBS script is usually more obscure, difficult to understand, today, a sneak, write a PowerShell script to read the Windows product key.
The code is as follows:
Copy Code code as follows:
===== FileName: get-windowsproductkey.ps1=====
function Get-windowsproduct
(The modification method in this article refers to http://www.cnblogs.com/grapeot/archive/2010/02/22/1670822.html, just one of the steps to modify it.) )This is achieved by modifying the profile, which is described in http://technet.microsoft.com/en-us/library/bb613488 (v=vs.85). aspx1. Change its window background and icon to the following effect:2. Generate profileFirst to see if there is already a profile,>test-path $profileIf the profile exists, t
WMI is the abbreviation for Windows Management specification, which contains a lot of system hardware and software information. Windows user information can also be obtained through WMI objects. PowerShell provides access to WMI, very handy and powerful-this is the cmdlet get-wmiobject.
Get a list of all Windows users
PowerShell offers powerful features in dealing with Windows services, and many convenient, powerful cmdlet waiting for you to patronize.
Get-service, alias GSV, gets the service object.Example: GSV eventlog or $evtlog = GSV EventLog
Start-service, start the service.
Stop-service, stop the service.
Restart-service, restart the service.
Suspend-service, suspend/suspend service.
Resume-service, continue
You may already be familiar with the method of creating a Windows USB boot disk for operating system booting and installing, which typically requires third-party tools such as Ultraiso,windows 7 USB tool or RM to load installation ISO image files, Copy the install binary and then use the DiskPart Disk Management tool to encapsulate the boot partition.
In WINDOWS8 now, USB boot disk is made simpler, you can
Using the FSharp code compiler in a Windows PowerShell session$fSharpCode = @ "Moduletest Let HelloWorld = "Hello World!!!!" printfn "%s" HelloWorld Let rec Loop n = seq [ if n () Else yield N; yield! Loop (n-1) ] |> seq.sort printfn "%A" (Loop 5) Let rec factorial x = If x = 0 Then 1 Else x * (factorial (x-1))"@#>$env:P Ath = $env:P Ath + "; C:\ProgramFiles\Microsoft sdks\f#\3.0\framework\v4.0 "Add-type -
=" float: none; "title=" 1.PNG "alt=" Wkiom1x4-uwaiui2aagghaznvrm148.jpg "/>650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/42/wKioL1X4-3yxulR8AAEV0mqB1HM575.jpg "style=" float: none; "title=" 2.PNG "alt=" Wkiol1x4-3yxulr8aaev0mqb1hm575.jpg "/>Because it was a different event, the result of his eventdata was not the same, so I made some changes.[XML] $xmlFilter =@ "The results are as follows650) this.width=650; "src=" http://s3.51cto.com
The last time I gave an overview of hyper-V 3.0 and added many new enterprise-level features, which deserves attention.
This time, we continue to focus on hyper-V 3.0 and test virtual hard disk management.
Test script download
All scripts in this series pass the Windows Server 8 (powershell ise x64) test.
1. Create a virtual hard disk
Create a virtual hard disk in vhd format, with a size of 10
the running Code host$Script1={For($i=0;$i -le 100;$i++){Add-Content -Path D:\File1.txt -Value "I want add some word in this file"}}$Script2={$NW=New-Object System.IO.StreamWriter "d:\file1.txt"; For($i=0;$i -lt 100;$i++){$NW.WriteLine("I Write it again !")};$nw.Close()}PS C:\Windows\system32> Measure-Command -Expression $Script1 | select TotalMillisecondsTotalMilliseconds----------------- 117.5692PS C:\W
The pipeline is not a new thing, the previous CMD console also has redirected commands, such as Dir | More can display the results in a separate screen.The traditional cmd pipeline is text-based, but PowerShell is based on objects.
Ps> ls | Sort-object-descending Name | Select-object Name,length,lastwritetime | convertto-html | Out-file ls.html
ps> get-content. ls.html
Name Length lastwritetime
test.vbs 170 2011/11/28 16:42:03
t
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.