Вы находитесь на странице: 1из 8

Modules)

•  A)script)with)extension).psm1,)great)for)code)
reuse.)
•  Use)Get7Module1–ListAvailable1to)list)all)
available)modules.)
•  Use)Import7Module)to)import)a)module)
Import_Module1<modulename>1
Import_Module1<modulepath>1
1

26)
Modules)
•  You)can)create)a)module)just)by)renaming)
your)script)to).psm1)
1copy1.\script_ex.ps11.\module_ex.psm11
•  You)can)also)control)what)to)expose)in)a)
module)using)Export7ModuleMember.1
•  We)will)not)touch)Module)manifest)and)
related)things.)

27)
Exercise)5)
•  Try)to)import)a)module.)
•  Can)you)import)a)par.cular)func.on)or)cmdlet)
from)a)module?)
•  Write)a)module)which)gets)last)modified)date)
of)file.)

28)
Registry)Access)with)PowerShell)
•  Registry)could)be)accessed)as)drive)due)to)
Registry)psprovider.)
)Get7PSProvider1–PSProvider1Registry1
•  HKLM)and)HKCU)are)available)by)default)while)
other)hives)could)be)accessed)using)other)
ways.)
•  Very)easy)and)powerful)way)to)access)the)
Registry.)
Registry)Access)with)PowerShell)
•  Three)core)cmdlets#)used)to)access)registry:)
–  Get7Item1
–  Get7ChildItem1
–  Get7ItemProperty1
•  Use)Get7Item)to)get)details)(list)of)proper.es))of)the)
registry)key.)
•  Use)Get7ChildItem1to)list)sub7keys)of)a)key.)Use)the))
17Recurse1parameter)to)list)recursively.)
•  Use)Get7ItemProperty)to)view)values)of)registry)keys.)
)
1
Registry)Access)with)PowerShell)
•  To)edit/create/rename)values)in)registry:)
–  Set7Item1
–  Set7ItemProperty1
–  New7Item1
–  Rename7Item1
–  New7ItemProperty1
–  Rename7Itemproperty1
)
1
Registry)Access)with)PowerShell)
•  Accessing)other)Registry)hives)
•  By)using)the)New7PSDrive)cmdlet)we)can)
create))new)PSDrives))
1New7PSDrive17Name1<nameofpsdrive>1117
PSProvider1Registry17Root1Registry::HKEY_USERS1
•  By)sexng)the)loca.on)to)Registry)ROOT)
)Set7Loca.on1Registry::1
1We)can)now)use)the)core)cmdlets)to)access)the)
registry)keys.)
)
1
Exercise)6)
•  Find)all)currently)and)recently)logged)on)users)
on)a)machine.)
•  Get)browsing)history)(typed)urls))from)
Internet)Explorer.)
•  Can)you)think)of)five)interes.ng)Registry)Keys)
which)could)be)useful)in)Pen)Tests.)
•  Set)cmd.exe)as)debugger)for)sethc.exe)and)
u.lman.exe)in)Registry.)

33)

Вам также может понравиться