Archive for July, 2011

Connecting to the registry with PowerPoint

Saturday, July 9th, 2011

To connect to the registry, we can list our possible choices using get-psdrive. The output will be similar to the below:

Name Used (GB) Free (GB) Provider Root
—- ——— ——— ——– —-
Alias Alias
C 240.39 57.60 FileSystem C:\
cert Certificate \
D 5.81 FileSystem D:\
E 3.64 FileSystem E:\
Env Environment
Function Function
HKCU Registry HKEY_CURRENT_USER
HKLM Registry HKEY_LOCAL_MACHINE
Variable Variable
WSMan WSMan

To mount the registry as a drive enter the command set-location: for example

set-location HKCU:

Note the colon at the end of the command.

You can then list the various items by using ls or Get-ChildItem. Setting the drive to the environment (Set-Location Env:) and then using Get-ChildItem lists all of the environment settings for the system

Setting up your PowerShell Environment

Saturday, July 9th, 2011

Want to have your powershell environment the way you want it each time you start PowerShell ?

Find the location of your default profile by typing profile$ at a PowerShell prompt. That will show you where your default profile script is held. For example:

C:\Users\philipflint\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

Any statements that you add to this script will automatically be run each time you start PowerShell.

In this way you can call any plug ins or other scripts that you want.

Getting Environment Variables with Powershell

Saturday, July 9th, 2011

Need to know the value of an environment variable on your computer such as the temp path ? Nothing could be easier.

$env:temp

OR

$env:tmp

Wnat to know who you are logged on as ?

$env:username

Want to know what the “path” is ?

$env:path

So, the trick is to enter $env: followed by the environment variable you want the value of. Want to know what environment variables you can use ?

Just access the advanced tab of computer properties and click on the “Environment Vaiables” button