02/01/2020

Powershell -1 PSDrive

Windows ta linuxtekinden farklı olarak file system dışında sistmelerde vardır. Mesela Registryde veya certstore da file sistem gibi gezmek mümkündür. İçerikleri görebiliriz ama file systemde yaptığımız işlemler burada farklı çalışır.

PS C:\> cd hkcu:
PS HKCU:\> dir


    Hive: HKEY_CURRENT_USER


Name                           Property
----                           --------
AppEvents
Console                        CtrlKeyShortcutsDisabled : 0
                               CursorColor              : 4294967295
                               CursorSize               : 25
                               DefaultBackground        : 4294967295
                               DefaultForeground        : 4294967295
                               EnableColorSelection     : 0
                               ExtendedEditKey          : 1
                               ExtendedEditKeyCustom    : 0
                               FaceName                 : __DefaultTTFont__
                               FilterOnPaste            : 1
                               FontFamily               : 0
                               FontSize                 : 1048576
                               FontWeight               : 0
                               ForceV2                  : 1
                               FullScreen               : 0
                               HistoryBufferSize        : 50
                               HistoryNoDup             : 0
                               InsertMode               : 1
                               LineSelection            : 1
                               LineWrap                 : 1
                               LoadConIme               : 1
                               NumberOfHistoryBuffers   : 4
                               PopupColors              : 245
                               QuickEdit                : 1
                               ScreenBufferSize         : 589889656
                               ScreenColors             : 7
                               ScrollScale              : 1
                               TerminalScrolling        : 0
                               TrimLeadingZeros         : 0
                               WindowAlpha              : 255
                               WindowSize               : 1966200
                               WordDelimiters           : 0
                               ColorTable00             : 0
                               ColorTable01             : 8388608
                               ColorTable02             : 32768
                               ColorTable03             : 8421376
                               ColorTable04             : 128
                               ColorTable05             : 8388736
                               ColorTable06             : 32896
                               ColorTable07             : 12632256
                               ColorTable08             : 8421504
                               ColorTable09             : 16711680
                               ColorTable10             : 65280
                               ColorTable11             : 16776960
                               ColorTable12             : 255
                               ColorTable13             : 16711935
                               ColorTable14             : 65535
                               ColorTable15             : 16777215
                               CurrentPage              : 3
Control Panel
Environment                    TEMP                  : C:\Users\can\AppData\Local\Temp
                               TMP                   : C:\Users\can\AppData\Local\Temp
                               Path                  : C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\I
                               ntel\WirelessCommon\;C:\Users\c
                                                       an\AppData\Local\Microsoft\WindowsApps;C:\Users\can\AppData\Loca
                               l\atom\bin;
                               OneDrive              : C:\Users\can\OneDrive
                               SSH_AUTH_SOCK         : /tmp/ssh-bh1cEupdliI4/agent.2696
                               SSH_AGENT_PID         : 5600
                               TACVIEW_DCS2ACMI_PATH : C:\PROGRA~2\Tacview\DCS\
                               PT6HOME               : C:\Program Files (x86)\Cisco Packet Tracer 6.1.1sv
                               PT5HOME               : C:\Program Files (x86)\Cisco Packet Tracer 6.1.1sv
                               QT_DEVICE_PIXEL_RATIO : auto
                               OneDriveConsumer      : C:\Users\can\OneDrive
EUDC
Keyboard Layout
Microsoft
Network
Printers
Software


    Hive: HKEY_CURRENT_USER\Software


Name                           Property
----                           --------
PDFsam Basic                   installed : 1


    Hive: HKEY_CURRENT_USER


Name                           Property
----                           --------
System
Uninstall
Volatile Environment           LOGONSERVER               : \\MONSTER
                               USERDOMAIN                : MONSTER
                               USERNAME                  : can
                               USERPROFILE               : C:\Users\can
                               HOMEPATH                  : \Users\can
                               HOMEDRIVE                 : C:
                               APPDATA                   : C:\Users\can\AppData\Roaming
                               LOCALAPPDATA              : C:\Users\can\AppData\Local
                               USERDOMAIN_ROAMINGPROFILE : MONSTER

Böylece normalde aldığımız “dir” komutundan çok daha farklı bir çıktı alırız.

İşte bu farklı sistemlere “PSDrive” deniyor.

“Get-PSDrive” ile bu değişik sistemleri listeleyebiliriz.

PS C:\Users\can> Get-PSDrive

Name           Used (GB)     Free (GB) Provider      Root                                               CurrentLocation
----           ---------     --------- --------      ----                                               ---------------
Alias                                  Alias
C                 163.84         58.39 FileSystem    C:\                                                      Users\can
Cert                                   Certificate   \
D                 695.36        236.15 FileSystem    D:\
E                                      FileSystem    E:\
Env                                    Environment
F                                      FileSystem    F:\
Function                               Function
G                                      FileSystem    G:\
HKCU                                   Registry      HKEY_CURRENT_USER
HKLM                                   Registry      HKEY_LOCAL_MACHINE
I                                      FileSystem    I:\
J                                      FileSystem    J:\
Variable                               Variable
WSMan                                  WSMan

Environment değişkenleri sistem değişkenleride gördüğünüz gibi burada. Bunlara basit bir şekilde erişebiliriz.

Drivelar C gibi sonunda “:” oldugundan burda da drive gibi baglandigindan Env: seklinde yaziyoruz. Sonuçta bunlarda PSDrive yani Powershell Drive’dır

Bu listede görülmeyen registry adreslerine de erişebiliriz.

#Set-Location Registry::\HKEY_USERS#

ve

New-PSDrive HKU Registry HKEY_USERS
Set-Location HKU:

Sayfa 4 Linux Man page den devam

Leave a Reply