Clever programmers are making more and more modules for PowerShell. Make
sure you benefit from their manifest, binary and script modules.
You have probably used existing cmdlets such as Get-Process, Get-ChildItem
or Restart-Service. Well, Import-Module extends your toolbox by
adding specialist functions such as Get-RegString. The hardest part
- and that's not too difficult - is locating suitable modules to download.
Note 1: I expect that no cmdlets or functions are present at this stage,
even if you try Get-Command get-*reg*.
Download Your Module:
Rather than giving you a link to Codeplex, where you may not have an
account, I suggest that you find a suitable source by googling: 'Download
PSRemoteRegistry'.
Install PSRemoteRegistry:
After double-clicking the .msi file, recommend that you direct the install
to this path: $home\Documents\WindowsPowerShell\Modules
Alternatively, you could copy the files to: %SystemRoot% \WindowsPowerShell\v1.0\Modules\
Note 2: $home corresponds to C:\Users\Guy (or
whatever is the username)
%SystemRoot is usually at C: \Windows \sytem32\
While this is best practice it is possible to use
Import-Module to add manifests at other location.
Now that your new cmdlets, or to give them the correct name - functions,
have arrived, let us see what we have.
# To check what the PSRemoteRegistry contains Clear-Host
Get-Command -Module PSRemoteRegistry | Ft Name, CommandType -auto
Get-RegBinary
Function Get-RegDefault
Function Get-RegDWord
Function Get-RegExpandString Function Get-RegKey
Function Get-RegMultiString Function
Get-RegQWord
Function Get-RegString
Function Get-RegValue
Function New-RegKey
Function Remove-RegKey
Function Remove-RegValue
Function Set-RegBinary
Function Set-RegDefault
Function Set-RegDWord
Function Set-RegExpandString Function
Set-RegMultiString Function
Set-RegQWord
Function Set-RegString
Function Test-RegKey
Function Test-RegValue
Function
Note 4: Another way of researching your module is
with Get-Module -List. I find the best way to see the properties is
to pipe the output into Format-List -properties *.
See more on this
PowerShell Module technique.
Note 5: See these new modules in action with
Set-RegString.
Guy Recommends: SolarWinds' Free Bulk Import Tool
Import users from a spreadsheet. Just provide a list of the
users with their fields in the top row, and save as .csv file.
Then launch this FREE utility and match your fields with AD's
attributes, click and import the users.
PowerShell has a startup folder, which we can access it via the
$Profile variable. There are two profile files, one for PowerShell's
ISE and another for the plain command-line PowerShell. Fortunately,
you can launch notepad and edit either of them.
Note 6: As usual, Get-Help comes up with useful parameters
such as -verbose. Furthermore, the -full switch supplies interesting
examples, such as: Get-Module -ListAvailable | Import-Module
More Help with About_Module I am impressed with advice
about using and installing modules provided in the 'about_module' help
file. Just type:
Clear-Host Get-Help About_Module
It reminds us how to install, import and the find your module's commands.
Have you ever been 25 and wish you could be 16 again? Well, if I had
my time with PowerShell again I would have imported more modules earlier in
my career.
If you like this page then please share it with your friends
Windows Management Instrumentation (WMI) is
most useful for PowerShell scripting.
SolarWinds
have produced this
Free WMI Monitor to take the guess work out of which
WMI counters to use for applications like Microsoft Active Directory,
SQL or Exchange Server.