Windows Powershell tutvustus: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Mjogi (talk | contribs)
No edit summary
Mjogi (talk | contribs)
No edit summary
Line 19: Line 19:
(Eneta, 2010)
(Eneta, 2010)
==Käsud==
==Käsud==
* Windows PowerShell\\ (Cmdlet)*
<&#33;DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled 1</title><style type="text/css">
 
table.MsoNormalTable
* Windows PowerShell\\ (Alias)*
{line-height:115%;
 
font-size:11.0pt;
* Description*
font-family:"Calibri","sans-serif";
 
}
Get-Location
p.MsoNormal
 
{margin-top:0cm;
gl, pwd
margin-right:0cm;
 
margin-bottom:10.0pt;
Kuva praegune asukoht
margin-left:0cm;
 
line-height:115%;
Set-Location
font-size:11.0pt;
 
font-family:"Calibri","sans-serif";
sl, cd, chdir
}
 
</style></head><body>
Muuda praegust asukohta
{|  class="MsoNormalTable" border="0" cellpadding="0" width="100%" style="width:100.0%;mso-cellspacing:1.5pt;mso-yfti-tbllook:1184"  style="mso-yfti-irow:0;mso-yfti-firstrow:yes"
 
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
Clear-Host
text-align:center;line-height:normal"><b><span style="font-size:12.0pt;
 
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
cls, clear
mso-fareast-language:ET">Windows PowerShell<br />
 
(Cmdlet)<o:p></o:p></span></b></p>
Puhasta konsool
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
 
text-align:center;line-height:normal"><b><span style="font-size:12.0pt;
Copy-Item
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
 
mso-fareast-language:ET">Windows PowerShell<br />
cpi, copy, cp
(Alias)<o:p></o:p></span></b></p>
 
|  style="padding:.75pt .75pt .75pt .75pt" |
Kopeeri �ks v�i mitu faili (v�i terve kataloog)
|  style="padding:.75pt .75pt .75pt .75pt" |
 
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
Get-Help
text-align:center;line-height:normal"><b><span style="font-size:12.0pt;
 
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
help, man
mso-fareast-language:ET">Description<o:p></o:p></span></b></p>
 
|-  style="mso-yfti-irow:1"
K�skude abi
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
 
text-align:center;line-height:normal"><span style="font-size:12.0pt;
Remove-Item
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
 
mso-fareast-language:ET">Get-Location<o:p></o:p></span></p>
ri, del, erase, rmdir, rd, rm
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
 
text-align:center;line-height:normal"><span style="font-size:12.0pt;
Kustuta fail/kataloog
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
 
mso-fareast-language:ET">gl, pwd<o:p></o:p></span></p>
Rename-Item
|  style="padding:.75pt .75pt .75pt .75pt" |
 
|  style="padding:.75pt .75pt .75pt .75pt" |
rni, ren
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
 
text-align:center;line-height:normal"><span style="font-size:12.0pt;
Muuda faili v�i kataloogi nime
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
 
mso-fareast-language:ET">Kuva praegune asukoht<o:p></o:p></span></p>
Move-Item
|-  style="mso-yfti-irow:2"
 
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
mi, move, mv
text-align:center;line-height:normal"><span style="font-size:12.0pt;
 
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
Liiguta faili v�i kataloogi mujale
mso-fareast-language:ET">Set-Location<o:p></o:p></span></p>
 
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
Get-ChildItem
text-align:center;line-height:normal"><span style="font-size:12.0pt;
 
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
gci, dir, ls
mso-fareast-language:ET">sl, cd, chdir<o:p></o:p></span></p>
 
|  style="padding:.75pt .75pt .75pt .75pt" |
Kuva k�ik failid ja kataloogid(preaguses kaustas)
|  style="padding:.75pt .75pt .75pt .75pt" |
 
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
Write-Output
text-align:center;line-height:normal"><span style="font-size:12.0pt;
 
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
echo, write
mso-fareast-language:ET">Muuda praegust asukohta<o:p></o:p></span></p>
 
|-  style="mso-yfti-irow:3"
Print strings, variables etc. to standard output
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
 
text-align:center;line-height:normal"><span style="font-size:12.0pt;
Pop-Location
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
 
mso-fareast-language:ET">Clear-Host<o:p></o:p></span></p>
popd
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
 
text-align:center;line-height:normal"><span style="font-size:12.0pt;
Change the current directory to the directory most recently pushed onto the stack
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
 
mso-fareast-language:ET">cls, clear<o:p></o:p></span></p>
Push-Location
|  style="padding:.75pt .75pt .75pt .75pt" |
 
|  style="padding:.75pt .75pt .75pt .75pt" |
pushd
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
 
text-align:center;line-height:normal"><span style="font-size:12.0pt;
Push the current directory onto the stack
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
 
mso-fareast-language:ET">Puhasta konsool<o:p></o:p></span></p>
Set-Variable
|-  style="mso-yfti-irow:4"
 
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
sv, set
text-align:center;line-height:normal"><span style="font-size:12.0pt;
 
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
Set the value of a variable / create a variable
mso-fareast-language:ET">Copy-Item<o:p></o:p></span></p>
 
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
Get-Content
text-align:center;line-height:normal"><span style="font-size:12.0pt;
 
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
gc, type, cat
mso-fareast-language:ET">cpi, copy, cp<o:p></o:p></span></p>
 
|  style="padding:.75pt .75pt .75pt .75pt" |
Get the content of a file
|  style="padding:.75pt .75pt .75pt .75pt" |
 
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
Select-String
text-align:center;line-height:normal"><span style="font-size:12.0pt;
 
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
Print lines matching a pattern
mso-fareast-language:ET">Kopeeri üks või mitu faili (või terve kataloog)<o:p></o:p></span></p>
 
|-  style="mso-yfti-irow:5"
Get-Process
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
 
text-align:center;line-height:normal"><span style="font-size:12.0pt;
gps, ps
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
 
mso-fareast-language:ET">Get-Help<o:p></o:p></span></p>
List all currently running processes
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
 
text-align:center;line-height:normal"><span style="font-size:12.0pt;
Stop-Process
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
 
mso-fareast-language:ET">help, man<o:p></o:p></span></p>
spps, kill
|  style="padding:.75pt .75pt .75pt .75pt" |
 
|  style="padding:.75pt .75pt .75pt .75pt" |
Stop a running process
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
 
text-align:center;line-height:normal"><span style="font-size:12.0pt;
Tee-Object
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
 
mso-fareast-language:ET">Käskude abi<o:p></o:p></span></p>
tee
|-  style="mso-yfti-irow:6"
 
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
Pipe input to a file or variable, then pass the input along the pipeline
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Remove-Item<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">ri, del, erase, rmdir, rd, rm<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Kustuta fail/kataloog<o:p></o:p></span></p>
|-  style="mso-yfti-irow:7"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Rename-Item<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">rni, ren<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Muuda faili või kataloogi nime<o:p></o:p></span></p>
|-  style="mso-yfti-irow:8"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Move-Item<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">mi, move, mv<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Liiguta faili või kataloogi mujale<o:p></o:p></span></p>
|-  style="mso-yfti-irow:9"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Get-ChildItem<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">gci, dir, ls<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Kuva kõik failid ja kataloogid(preaguses kaustas)<o:p></o:p></span></p>
|-  style="mso-yfti-irow:10"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Write-Output<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">echo, write<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Print strings, variables etc. to standard output<o:p></o:p></span></p>
|-  style="mso-yfti-irow:11"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Pop-Location<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">popd<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Change the current directory to the directory most  
recently pushed onto the stack<o:p></o:p></span></p>
|-  style="mso-yfti-irow:12"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Push-Location<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">pushd<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Push the current directory onto the stack<o:p></o:p></span></p>
|-  style="mso-yfti-irow:13"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Set-Variable<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">sv, set<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Set the value of a variable / create a variable<o:p></o:p></span></p>
|-  style="mso-yfti-irow:14"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Get-Content<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">gc, type, cat<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Get the content of a file<o:p></o:p></span></p>
|-  style="mso-yfti-irow:15"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Select-String<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Print lines matching a pattern<o:p></o:p></span></p>
|-  style="mso-yfti-irow:16"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Get-Process<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">gps, ps<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">List all currently running processes<o:p></o:p></span></p>
|-  style="mso-yfti-irow:17"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Stop-Process<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">spps, kill<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Stop a running process<o:p></o:p></span></p>
|-  style="mso-yfti-irow:18;mso-yfti-lastrow:yes"
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Tee-Object<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">tee<o:p></o:p></span></p>
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" |
|  style="padding:.75pt .75pt .75pt .75pt" | <p class="MsoNormal" align="center" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal"><span style="font-size:12.0pt;
font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;;
mso-fareast-language:ET">Pipe input to a file or variable, then pass the input  
along the pipeline<o:p></o:p></span></p>
|}</body></html>





Revision as of 21:24, 14 March 2010

Sissejuhatus

....

Autor

  • Martin Jõgi
  • Grupp A21

Üldine

Mis on Windows Powershell?

Windows powershell (2.0) on revolutsiooniline skriptimiskeel ja käsurea keskkond, mis elab Elab .NET Framework’i seljas. See on lisatud Windows 7 ja Windows Server 2008 R2 sisse. Powershell 2.0 võimaldab kaughaldust kõigile serveritele ja rakendustele, haldust on võimalik teha läbi Powershelli. Näiteks Exchange 2010, Windows Server 2008 R2(ning uuemad Microsofti server-tooted). Powershell 2.0-s ei pea oma masinasse enam rakenduste haldusliidest installima. Halduseks vajalikud käsud käitatakse serveril, käsurida jooksutatakse aga masinas. Powershellis pole vaja leida, paigaldada ega tundma õppida uusi tööriistu või käske - kõik on lihtsalt avastatav. Windows powershellil on paindlik väljund ehk ühe käsu väljund võib olla teise käsu sisendiks (nagu bash shellis). Windows Powershell vähendab tulemuse saavutamise aega säilitades ühtlase keele.


Tugevused:

  • Järjekindel süntaks: Add, New, Get, Set, Remove, Clear, Connection, EventLog, Member, Printer, Service, Transaction ja WmiObject
  • Komponeeritav: Interaktiivsed keskkonnad võimaldavad tükk-haaval lahenduste loomist ja lihtsalt kokkuseotav (“toru”) keeruliste ülesannete lahendamiseks.
  • Tulemuste saavutamise aeg on palju lühem
  • Laiendatavus Moodulid viivad asja järgmisele tasemele.
  • Skriptimine Skriptimine ei ole enam ajutiste lahenduste leiutamiseks. Tööriistakomplekt on täienenud.
  • Integreeritud läbi serveri rollide Active Directory®, Exchange, Group Policy, jne.
  • Paindlik väljund: PowerShelli väljundiks on objektid, mida on lihtne teisendada ja tarbida järgmise käsu poolt (ei mingit tekstitöötlust!).

(Eneta, 2010)

Käsud

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled 1</title><style type="text/css"> table.MsoNormalTable {line-height:115%; font-size:11.0pt; font-family:"Calibri","sans-serif"; } p.MsoNormal {margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; font-size:11.0pt; font-family:"Calibri","sans-serif"; } </style></head><body>

Windows PowerShell
(Cmdlet)<o:p></o:p>

Windows PowerShell
(Alias)<o:p></o:p>

Description<o:p></o:p>

Get-Location<o:p></o:p>

gl, pwd<o:p></o:p>

Kuva praegune asukoht<o:p></o:p>

Set-Location<o:p></o:p>

sl, cd, chdir<o:p></o:p>

Muuda praegust asukohta<o:p></o:p>

Clear-Host<o:p></o:p>

cls, clear<o:p></o:p>

Puhasta konsool<o:p></o:p>

Copy-Item<o:p></o:p>

cpi, copy, cp<o:p></o:p>

Kopeeri üks või mitu faili (või terve kataloog)<o:p></o:p>

Get-Help<o:p></o:p>

help, man<o:p></o:p>

Käskude abi<o:p></o:p>

Remove-Item<o:p></o:p>

ri, del, erase, rmdir, rd, rm<o:p></o:p>

Kustuta fail/kataloog<o:p></o:p>

Rename-Item<o:p></o:p>

rni, ren<o:p></o:p>

Muuda faili või kataloogi nime<o:p></o:p>

Move-Item<o:p></o:p>

mi, move, mv<o:p></o:p>

Liiguta faili või kataloogi mujale<o:p></o:p>

Get-ChildItem<o:p></o:p>

gci, dir, ls<o:p></o:p>

Kuva kõik failid ja kataloogid(preaguses kaustas)<o:p></o:p>

Write-Output<o:p></o:p>

echo, write<o:p></o:p>

Print strings, variables etc. to standard output<o:p></o:p>

Pop-Location<o:p></o:p>

popd<o:p></o:p>

Change the current directory to the directory most recently pushed onto the stack<o:p></o:p>

Push-Location<o:p></o:p>

pushd<o:p></o:p>

Push the current directory onto the stack<o:p></o:p>

Set-Variable<o:p></o:p>

sv, set<o:p></o:p>

Set the value of a variable / create a variable<o:p></o:p>

Get-Content<o:p></o:p>

gc, type, cat<o:p></o:p>

Get the content of a file<o:p></o:p>

Select-String<o:p></o:p>

Print lines matching a pattern<o:p></o:p>

Get-Process<o:p></o:p>

gps, ps<o:p></o:p>

List all currently running processes<o:p></o:p>

Stop-Process<o:p></o:p>

spps, kill<o:p></o:p>

Stop a running process<o:p></o:p>

Tee-Object<o:p></o:p>

tee<o:p></o:p>

Pipe input to a file or variable, then pass the input along the pipeline<o:p></o:p>

</body></html>


Moodulid

Scriptimise mugavuse muutmiseks on olemas Windows Powershell Pack, mis sisaldab 10 moodulit. See pakk aitab kirjutada kasutajaliideseid powershell scriptis, hallata RSS feede, toimetada Task Scheduler-s otse käsurealt jne. Tõmba siit: PowerShellPack Näiteks:

  • Taskide haldamine:
 PS> New-task | 
Add-TaskTrigger -DayOfWeek Monday, Wednesday, Friday -WeeksInterval 2 -At "3:00 PM" |
 Add-TaskAction -Script {
   Get-Process | Out-GridView
   Start-Sleep -Seconds 100
 } |
 Register-ScheduledTask TestTask
  • RSS feedide töötlemine:
 PS> Get-Feed |
Get-Article |
 Sort-Object PubDate -Descending |
 Select-Object Title, Description -First 10 |
 Out-GridView

Ajalugu

Every released version of Microsoft DOS and Microsoft Windows for personal computers has featured a command-line interface tool. These are COMMAND.COM (in installations relying on MS-DOS, including Windows 9x) and cmd.exe (in Windows NT-family operating systems). These are regular command line interpreters that include only a handful of basic commands. For other purposes, a separate console application needs to be provided, to be invoked from these shells. They also include a scripting language (batch files), which can be used to automate various tasks. However, they cannot be used to automate all facets of GUI functionality, in part because command-line equivalents of operations exposed via the graphical interface are limited, and the scripting language is elementary, preventing the creation of complex scripts by composing available functionality. In Windows Server 2003, the situation was improved,[8] but scripting support was still considered unsatisfactory.

Microsoft attempted to address some of these shortcomings by introducing the Windows Script Host in 1998 with Windows 98, and its command-line based host: cscript.exe . It integrates with the Active Script engine and allows scripts to be written in compatible languages, such as JScript and VBScript, leveraging the APIs exposed by applications via COM. However, it has its own deficiencies, as well. It is not integrated with the shell, its documentation is not very accessible, and it quickly gained a reputation as a system vulnerability vector after several high-profile computer viruses exploited weaknesses in its security provisions. Different versions of Windows provided various special-purpose command line interpreters (such as netsh and WMIC) with their own command sets. None of them were integrated with the command shell; nor were they interoperable.

By 2003, Microsoft had started to develop a new shell called Monad (aka Microsoft Shell or MSH). Monad was to be a new extensible command shell with a fresh design that would be capable of automating a full range of core administrative tasks. Microsoft published the first Monad public beta release on June 17, 2005, Beta 2 on September 11, 2005, and Beta 3 on January 10, 2006. They announced on April 25, 2006 that Monad was renamed to Windows PowerShell, positioning it as a significant part of their management technology offerings.[9] Release Candidate 1 of PowerShell was released at the same time. Release Candidate 2 of PowerShell was released September 26, 2006 and released to web (RTW) on November 14, 2006. PowerShell for Vista was released on January 30, 2007.[10] The last CTP release of Windows PowerShell v2.0 was made available in December 2008.

PowerShell v2.0 was completed and released to manufacturing in August 2009, as an integral part to Windows 7 and Windows Server 2008 R2. Versions of PowerShell for downlevel OSs (i.e. Windows XP, Windows Server 2003, Windows Vista and Windows Server 2008) were released in October 2009 and are available for download for both 32-bit and 64-bit platforms.[11]

Näited

....



Kokkuvõte

Windows PowerShell on käsurea keskkond ja skriptimiskeel on eelkõige just süsteemiülematele. Powershell sisaldab järgmisi funktsioone: Käske(cmdlets), et kiirendada administreerimist, skriptimise võimalus, objektidega manipuleerimine (objekte on võimalik saata mujale tööriistadesse või andmebaasi) ning palju muud. Powershell on loodud just mõeldes IT spetsialisti peale, et võimaldada Windows süsteemide ja rakenduste haldamist ning automatiseerimist. Minu arust on Powershell vägagi asjalik ning vajalik tööriist.



Kasutatud kirjandus

  1. Eneta foorum
  2. PowerShellPack
  3. Windows Powershell - Wikipedia
  4. Microsoft TechNet - Powershell
  5. google.com