¿ù°£ Àα⠰Խù°

°Ô½Ã¹° 256°Ç
   
[2008] Windows PowerShell 1.0
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2009-12-29 (È­) 09:10 Á¶È¸ : 8270
±ÛÁÖ¼Ò :
                                
Âü°í : http://umttumt.org/107 
        http://blog.naver.com/yjsaga?Redirect=Log&logNo=80094183249


Windows PowerShell
Àº ½Ã½ºÅÛ °ü¸®ÀÚ¸¦ À§ÇØ Æ¯º°È÷ µðÀÚÀÎµÈ »õ·Î¿î Windows ¸í·ÉÁÙ ¼Ð·Î½á, Á¶ÇÕÇϰųª µ¶¸³ÀûÀ¸·Î »ç¿ëÇÒ¼ö ÀÖ´Â ´ëÈ­Çü ÇÁ·ÒÇÁÆ® ¹× ½ºÅ©¸³Æ® ȯ°æÀÌ Æ÷ÇԵǾîÀÖ´Ù.

Windows Server¸¦ °ü¸®ÇÏ´Ùº¸¸é, ¸®´ª½º¿Í ´Þ¸® Shell ½ºÅ©¸³Æ® Á¦ÀÛ¿¡ ºÒÆíÇÔÀÌ ÀÖ´Ù.
cmd·Î ±âº»ÀûÀÎ ±â´ÉµéÀÇ ±¸ÇöÀº °¡´ÉÇÏÁö¸¸, º¹ÀâÇÑ ÀÛ¾÷À» Çϱ⿡´Â ¹«¸®°¡ ÀÖ´Ù.
À̸¦ ±Øº¹Çϱâ À§ÇØ Windows PowerShellÀÌ ³ª¿ÔÀ¸¸ç, Windows 2008 Server¿¡¼­´Â ±âº»À¸·Î üÅÃÇÏ°í ÀÖ´Ù.
Windows PowerShell 1.0À» ÅëÇÏ¿© º¸´Ù ¸¹Àº ÀÛ¾÷µéÀÌ °¡´ÉÇØÁ³À¸¸ç, Windows PowerShell 1.0Àº WIndows Server 2003 ¿¡¼­µµ »ç¿ë °¡´ÉÇß¾úÀ¸³ª, 3rd PartyÀÇ ´À³¦À̾ú´Ù.
ÇÏÁö¸¸ Windows 2008 Server ¿¡¼­´Â WIndows PowerShell 1.0À» ±âº»À¸·Î üÅÃÇÔ°ú µ¿½Ã¿¡, ÇöÀç´Â WIndows PowerShell 2.0ÀÌ ¹ßÇ¥ µÇ¾ú°í, º¸´Ù ¸¹Àº ±â´ÉµéÀÇ °³¼±ÀÌ ÀÖ¾ú´Ù.

¶ÇÇÑ ¹«¾ùº¸´Ù °¡Àå Å« ÀÌÁ¡Àº ÀÌ¹Ì Àͼ÷ÇÑ µµ±¸¸¦ °è¼Ó »ç¿ëÇÒ ¼ö ÀÖ´Ù´Â Á¡ÀÔ´Ï´Ù. Áï, Net, SC ¹× Reg.exe¿Í °°Àº ±âÁ¸ Windows µµ±¸¸¦ Windows PowerShell¿¡¼­ ±×´ë·Î »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ·¹Áö½ºÆ®¸®, ÀÛ¾÷°ü¸®ÀÚ µî À©µµ¿ìÀÇ ¸ðµç ºÎºÐÀ» Á÷Á¢ ÄÁÆ®·Ñ ÇÒ ¼ö Àֱ⠶§¹®¿¡ °ü·Ã ºÐµéÀº ÀÚÁÖ »ç¿ëµÇ´Â ÅøÀÌ µÉ °ÍÀ¸·Î º¸ÀÔ´Ï´Ù.

À©µµ¿ìÀÇ °æ¿ì ±×·¡ÇÈÀ» »ç¿ëÇÑ UI°¡ °­È­µÇ¾î ÀÖ´Â °ÍÀÌ Æ¯Â¡ÀÔ´Ï´Ù. ±×·¯³ª ¸í·É¾î¸¦ Çؼ®ÇÏ´Â ÇÁ·Î±×·¥ÀÎ shell°ú °°Àº °æ¿ì¿¡´Â text UI°¡ ¼Óµµ ¸é¿¡¼­ ¿ì¿ùÇÕ´Ï´Ù. ÀÌ·±¸éÀ» ŸOS ºñÇØ º¸ÃæÇϱâ À§ÇÏ¿© ¸¸µé¾îÁø °ÍÀÌ Windows PowerShell ÀÌÁÒ... (CMD.exe ¿ª½Ã ¼ÐÀÇ ÀÏÁ¾ÀÌÁö¸¸¼­µµ...) 

ÅëÇÕ °³¹ß ȯ°æ(Integrated Development Environment, IDE)À̶ó´Â °ÍÀº °³¹ßÀÚ¿¡°Ô ÀÏ°üµÈ ÀÎÅÍÆäÀ̽º¸¦ Á¦°øÀ» Çؼ­ ÄÚµù, ÄÄÆÄÀÏ, µð¹ö±ë µî °³¹ß¿¡ ÆíÀ̼ºÀ» Á¦°øÇÏ´Â ¼ÒÇÁÆ®¿þ¾îÀûÀÎ µµ±¸ÀÌ´Ù. °°Àº ¸Æ¶ôÀ¸·Î ÆÄ¿ö¼Ð(PowerShell)¿¡¼­µµ ÅëÇÕ ½ºÅ©¸³Æà ȯ°æ(Integrated scripting Environment)ÀÌ ¶ó´Â ¾àĪ ISE°¡ Windows 7¿¡ žÀç µÇ¾ú½À´Ï´Ù. Áï, Windows PowerShell ISE(ÅëÇÕ ½ºÅ©¸³Æà ȯ°æ)´Â Ä£¼÷ÇÑ È¯°æ¿¡¼­ ½ºÅ©¸³Æ® ¹× ¸ðµâÀ» ÀÛ¼º, ½ÇÇà ¹× Å×½ºÆ®ÇÒ ¼ö Àִ ȣ½ºÆ® ÀÀ¿ë ÇÁ·Î±×·¥ÀÔ´Ï´Ù. ±¸¹® »ö ÁöÁ¤, ÅÇ ¿Ï¼º, ½Ã°¢Àû µð¹ö±ë, À¯´ÏÄÚµå ±ÔÁ¤ Áؼö ¹× »óȲ¿¡ ¸Â´Â µµ¿ò¸»°ú °°Àº ÁÖ¿ä ±â´ÉÀ» ÅëÇØ Ç³ºÎÇÑ ½ºÅ©¸³Æà ȯ°æÀ» Á¦°øÇÕ´Ï´Ù.

Windows Server 2003¿ë PowerShell 1.0 :
http://www.microsoft.com/downloads/details.aspx?FamilyID=c61fb27b-e71c-4ecf-9d2c-9b299b149490&DisplayLang=ko  
Windows PowerShell 2.0 :
http://www.microsoft.com/downloads/details.aspx?FamilyID=c913aeab-d7b4-4bb1-a958-ee6d7fe307bc&DisplayLang=en

½ÃÀÛ¹æ¹ý


½ÇÇà



 ¸î°¡Áö ¿¹Á¦µé....

PS C:\Users\Administrator> get-help
PowerShell  cmd ÀÇ °³³ä¿¡ ´ëÇÑ µµ¿ò¸» Ç¥½Ã

PS C:\Users\Administrator> get-help get-date

À̸§
    Get-Date

°³¿ä
    ÇöÀç ³¯Â¥ ¹× ½Ã°£À» °¡Á®¿É´Ï´Ù.

±¸¹®
    Get-Date [[-date] <DateTime>] [-displayHint {<Date> | <Time> | <DateTime>}] [-format <string>] [-year <int>] [-mont
    h <int>] [-day <int>] [-hour <int>] [-minute <int>] [-second <int>] [<CommonParameters>]
    Get-Date [[-date] <DateTime>] [-displayHint {<Date> | <Time> | <DateTime>}] [-uFormat <string>] [-year <int>] [-mon
    th <int>] [-day <int>] [-hour <int>] [-minute <int>] [-second <int>] [<CommonParameters>]

ÀÚ¼¼ÇÑ ¼³¸í
    ÇöÀç ³¯Â¥ ¹× ½Ã°£À» °¡Á®¿É´Ï´Ù.

°ü·Ã ¸µÅ©
    Set-Date
    New-TimeSpan

¼³¸í
    ÀÚ¼¼ÇÑ ³»¿ëÀ» º¸·Á¸é ´ÙÀ½°ú °°ÀÌ ÀÔ·ÂÇϽʽÿÀ. "get-help Get-Date -detailed".
    ±â¼úÀûÀÎ ³»¿ëÀ» º¸·Á¸é ´ÙÀ½°ú °°ÀÌ ÀÔ·ÂÇϽʽÿÀ. "get-help Get-Date -full".


±âÁ¸ cmdÀÇ echo¿Í °°Àº Write-Host. cmdÀÇ ¸í·Éµéµµ ±×´ë·Î »ç¿ëÇÒ ¼ö ÀÖ´Ù.

PS C:\Users\Administrator> Write-host "HELLO, MOJILY"
HELLO, MOJILY
PS C:\Users\Administrator> echo "HELLO, MOJILY"
HELLO, MOJILY


½Ã°£ Ç¥½Ã

PS C:\Users\Administrator> date
2009³â 12¿ù 29ÀÏ È­¿äÀÏ ¿ÀÀü 9:21:56

PS C:\Users\Administrator> get-date
2009³â 12¿ù 29ÀÏ È­¿äÀÏ ¿ÀÀü 9:22:02


½Ã°£ °¡Áö°í ³î±â

PS C:\Users\Administrator> [datetime]
IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     DateTime                                 System.ValueType

PS C:\Users\Administrator> [datetime]::now
2009³â 12¿ù 29ÀÏ È­¿äÀÏ ¿ÀÀü 9:23:09

PS C:\Users\Administrator> [datetime]::now.tostring()
2009-12-29 ¿ÀÀü 9:23:16

PS C:\Users\Administrator> [datetime]::now.addhours(-1)
2009³â 12¿ù 29ÀÏ È­¿äÀÏ ¿ÀÀü 8:23:34

PS C:\Users\Administrator> [datetime]::now.addhours(1).tostring()
2009-12-29 ¿ÀÀü 10:33:08


º¯¼ö ¹× ½Ã°£ Æ÷¸Ë ¹Ù²Ù±â

PS C:\Users\Administrator> $a=1
PS C:\Users\Administrator> write-host $a
1
PS C:\Users\Administrator> $b=3
PS C:\Users\Administrator> write-host $b
3
PS C:\Users\Administrator> $c=$a*$b
PS C:\Users\Administrator> write-host $c
3

PS C:\Users\Administrator> $date=[datetime]::now.addhours(-2)
PS C:\Users\Administrator> $date=get-date $date -uformat "%y+%m+%d+%H"
PS C:\Users\Administrator> write-host $date
09+12+28+09


get-command ¸í·É

PS C:\Users\Administrator> get-command wscript
CommandType     Name                                                Definition
-----------     ----                                                ----------
Application     wscript.exe                                         C:\Windows\system32\wscript.exe

PS C:\Users\Administrator> get-command *.msc
CommandType     Name                                                Definition
-----------     ----                                                ----------
Application     azman.msc                                           C:\Windows\system32\azman.msc
Application     certmgr.msc                                         C:\Windows\system32\certmgr.msc
Application     comexp.msc                                          C:\Windows\system32\comexp.msc
Application     compmgmt.msc                                        C:\Windows\system32\compmgmt.msc
Application     devmgmt.msc                                         C:\Windows\system32\devmgmt.msc
Application     diskmgmt.msc                                        C:\Windows\system32\diskmgmt.msc
Application     eventvwr.msc                                        C:\Windows\system32\eventvwr.msc
Application     fsmgmt.msc                                          C:\Windows\system32\fsmgmt.msc
Application     fsrm.msc                                            C:\Windows\system32\fsrm.msc
Application     gpedit.msc                                          C:\Windows\system32\gpedit.msc
Application     gpmc.msc                                            C:\Windows\system32\gpmc.msc
Application     gpme.msc                                            C:\Windows\system32\gpme.msc
Application     gptedit.msc                                         C:\Windows\system32\gptedit.msc
Application     lusrmgr.msc                                         C:\Windows\system32\lusrmgr.msc
Application     NAPCLCFG.MSC                                        C:\Windows\system32\NAPCLCFG.MSC
Application     perfmon.msc                                         C:\Windows\system32\perfmon.msc
Application     rsop.msc                                            C:\Windows\system32\rsop.msc
Application     secpol.msc                                          C:\Windows\system32\secpol.msc
Application     ServerManager.msc                                   C:\Windows\system32\ServerManager.msc
Application     services.msc                                        C:\Windows\system32\services.msc
Application     StorExpl.msc                                        C:\Windows\system32\StorExpl.msc
Application     tapimgmt.msc                                        C:\Windows\system32\tapimgmt.msc
Application     taskschd.msc                                        C:\Windows\system32\taskschd.msc
Application     tpm.msc                                             C:\Windows\system32\tpm.msc
Application     tsadmin.msc                                         C:\Windows\system32\tsadmin.msc
Application     tsconfig.msc                                        C:\Windows\system32\tsconfig.msc
Application     tsmmc.msc                                           C:\Windows\system32\tsmmc.msc
Application     wbadmin.msc                                         C:\Windows\system32\wbadmin.msc
Application     WF.msc                                              C:\Windows\system32\WF.msc
Application     WmiMgmt.msc                                         C:\Windows\system32\WmiMgmt.msc
Application     WSRM.msc                                            C:\Windows\system32\WSRM.msc


get-process ¸í·É

PS C:\Users\Administrator> get-process
Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName
-------  ------    -----      ----- -----   ------     -- -----------
    260       8     4884      12244    76     0.50  12808 atbsvc
     63       3     1380       3596    56     0.05   3884 conime
     64       3     1360       4520    50     0.19  43576 conime
    596       6     2552       4852   109     3.09    532 csrss
     84       5     1552       5048   143     0.44    576 csrss
    368       5     3256      12848   147     5.91   2716 csrss
    352       5     5932      15856   163     2.27  42188 csrss
    154       5     6384       8332    70     0.94  43280 daemon
     63       2      872       2948    34     0.02   1888 dwm
    101       3     2792       3904    49     0.33   3824 dwm
    769      18    31656      45228   219    43.09   3060 explorer
    497      13    18816      27128   138     2.88  30520 explorer
    101       4     8140       8808    53     0.16   2700 iashost
      0       0        0         24     0               0 Idle
    517      15    16888      25244   145     0.73  14820 iexplore
    387      12    11396      22036   135     0.72  43828 iexplore
    328      32    15088      16548    87    16.00   1812 inetinfo
    166      16     7296      12868    82     0.41    980 LogonUI
    171      16     6808      13484    70     0.28  40052 LogonUI
    940      13     6400       9784    57   114.02    672 lsass
    310       4     3072       4764    36     0.70    680 lsm
    710      26    96988      84564   366 1,603.23   1260 mmc
.......................................................................................
.......................................................................................
.......................................................................................


PS C:\Users\Administrator> get-process -inputobject $a |format-table -view priority

   PriorityClass: Normal

ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
atbsvc                    12808           259     12529664
conime                     3884            63      3682304
conime                    43576            64      4628480
csrss                       532           592      4968448
csrss                       576            84      5169152
csrss                      2716           366     13156352
csrss                     42188           354     16281600

   PriorityClass: BelowNormal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
daemon                    43280           154      8531968

   PriorityClass: Normal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
dwm                        1888            63      3018752
dwm                        3824           101      3997696
explorer                   3060           769     46313472
explorer                  30520           497     27779072
iashost                    2700           101      9019392
Idle                          0             0        24576
iexplore                  14820           517     25849856
iexplore                  43828           387     22564864
inetinfo                   1812           328     16945152

   PriorityClass: High
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
LogonUI                     980           166     13176832
LogonUI                   40052           171     13807616

   PriorityClass: Normal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
lsass                       672           943      9986048
lsm                         680           310      4878336
mmc                        1260           710     86593536
mmc                        7924           210      9375744
mmc                       41748           654    113229824

   PriorityClass: BelowNormal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
MSASCui                    2896           371     14110720
MSASCui                   41756           341      6475776

   PriorityClass: Normal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
msdtc                      3540           173      5566464

   PriorityClass: BelowNormal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
msnmsgr                   25908           529      3235840

   PriorityClass: Normal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
msnmsgr                   26132           554      5779456
mysqld-nt                  1924         35200     12533760
NavvyMan                  12428           246      4816896

   PriorityClass: BelowNormal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
NavvyMan                  30448           236      5754880

   PriorityClass: Normal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
portforward               11084         11267     17285120
powershell                48856           445     44650496
rdpclip                     796           160      6426624
rdpclip                   41340           146      6729728
services                    660           318      5992448
SLsvc                      1108           107      7639040
smss                        464            34       704512
snmp                        480           194      5496832
spoolsv                    1644           328      8400896
sqlwriter                   328            89      5918720
svchost                     272           131      3457024
svchost                     348            83      2228224
svchost                     568           241      3637248
svchost                     836           325      6086656
svchost                     844           126      6164480
svchost                     896           395      7254016
svchost                     936           418     42987520
svchost                    1036           557     27467776
svchost                    1068           171      5668864
svchost                    1092          1731     61399040
svchost                    1152           421      9777152
svchost                    1220           435     15904768
svchost                    1228           101      3702784
svchost                    1240            90      3006464
svchost                    1292           780     14237696
svchost                    1408           280      7335936
svchost                    1452           100      3162112
svchost                    1752           137      7565312
System                        4           794      1425408
taskeng                    2040           279      6795264

   PriorityClass: BelowNormal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
taskeng                    2248           147      5062656

   PriorityClass: Normal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
taskeng                   33492           272      8663040
TCPSVCS                     372            85      2916352
TrustedInstaller          48184           121      6123520
vmicsvc                    1668           101      3813376
vmicsvc                    1684            83      2457600
vmicsvc                    1700            83      2535424
vmicsvc                    1716            97      2523136
vmicsvc                    1732            98      2551808

   PriorityClass: High
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
wininit                     584           113      2637824
winlogon                    620           115      2539520
winlogon                   1372           147      3964928
winlogon                  46324           128      4984832

   PriorityClass: Normal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
WmiPrvSE                   2884           245     11276288
WMServer                   1480           392      9416704

   PriorityClass: High
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
wsrm                       2052           411     11849728

   PriorityClass: Normal
ProcessName                  Id   HandleCount   WorkingSet
-----------                  --   -----------   ----------
wuauclt                   49128            93      5386240

À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.