Skip to content

What powershell modules are located on the mashine and where are they ?

2011/06/23

Powershell sets an environment variable PSModulePath that names all directories where Modules can be located. Do a dir-command on them to find available modules.

There can be multiple entries that ere separated by a ; . The split method makes an array from a string where the ; is used to separate the array elements.  You cannot do a get-childitem (that is what the alias ls stands for) on all array items at once. That is why the foreach-object (aka %) is used to loop through the array elements:

 

PS C:\> (get-item env:PSModulePath).value.split(";")| %{ls $_}


    Directory: \\fileserver\username$\Personal Data\WindowsPowerShell\Modules


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----        07.06.2010     07:46            get-test
d----        07.06.2010     07:46            get-osinfo


    Directory: C:\windows\system32\WindowsPowerShell\v1.0\Modules


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d---s        14.04.2011     16:57            ActiveDirectory
d---s        19.10.2010     13:34            AppLocker
d---s        19.10.2010     13:34            BitsTransfer
d----        14.04.2011     16:57            FailoverClusters
d----        14.04.2011     16:57            GroupPolicy
d----        14.07.2009     06:52            PSDiagnostics
d----        19.10.2010     13:34            TroubleshootingPack


Advertisements

From → basics, powershell

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: