0/1 Lessons

Course Introduction

• 5min

0 / 2 lessons complete

Getting Started with Windows PowerShell

• 42min

0 / 7 lessons complete

Getting Help and Finding Commands

• 39min

0 / 6 lessons complete

PowerShell Command Syntax

• 33min

0 / 5 lessons complete

PowerShell Objects and Properties

• 35min

0 / 6 lessons complete

The PowerShell Pipeline

• 24min

0 / 2 lessons complete

PowerShell Providers

• 30min

0 / 5 lessons complete

PowerShell Arrays and Variables

• 28min

0 / 4 lessons complete

PowerShell Loops

• 19min

0 / 3 lessons complete

PowerShell Conditional Statements

• 11min

0 / 1 lessons complete

On Premises Lab Setup

• 36min

0 / 8 lessons complete

Basic Domain Administration with Windows PowerShell

• 2hr 27min

0 / 10 lessons complete

Send Emails with PowerShell

• 22min

0 / 2 lessons complete

PowerShell Desired State Configuration (DSC) Basics

• 1hr 48min

0 / 6 lessons complete

Course Conclusion

• 1min

0 / 1 lessons complete

PowerShell Provider CMDlets -1

Saving Progress...

In this lecture we will take a look at several different cmdlets that are designed for use with Powershell Providers. If you want to follow along you will need to download the lesson that came with this lecture. We will be copying and pasting commands into PowerShell.

If you would like a complete list of provider cmdlets and links for further information, download the document called PSProvider cmdlet links.pdf.

Location Cmdlets – These cmdlets are used for directory navigation. The cd (change directory) command can be used to navigate between directories. But, as the number of directories that we need to track grows, this approach becomes more and more inefficient, as most of these paths are usually too long to type. And that’s why location cmdlets can be extremely useful.

Get-Location – (alias GL) This cmdlet gets an object that represents the current directory.
      Sets the working location to a specified location

   Set-Location – (alias is SL) Sets the working location to a specified location. That location could be a directory, a subdirectory, a registry location, or any provider path.

      Push-Location – (alias is pushd) Adds ("pushes") the current location onto a location stack.

      Pop-Location – (alias is popd) Changes the current location to the location most recently pushed onto the stack by using the Push-Location cmdlet.

What is a stack? Think of a stack like a stack of books.

Graphical user interface  Description automatically generated


Guliver’s Travels


Moby Dick

I add books by adding them to the top of the stack. If I want to remove a book, let’s say Guliver’s Travels, normally I would remove the first book, then remove the second book. In computer terms this is referred to “Last in, first out” or (LIFO)
So my book stack has two methods, add and remove. So, in computer terms a stack has two methods push and pop. An item is pushed to the stack (added) or popped off (removed) from the stack.

I can demonstrate this by creating 4 folders.

Let’s say that we need to work with these four folders.

Table  Description automatically generated with medium confidence

From your C: drive create a folder called books, then create the four sub-folders. Stop the video while you do this.

Graphical user interface  Description automatically generated

Now lets add all four folders to the stack by using our pushd alias cmdlet

Type pushd c:\books\1984 (pressh return)

Type pushd c:\books\gulivers_travels

Type pushd c:\books\hamlet

Type pushd c:\books\moby_dick

Graphical user interface  Description automatically generated with low confidence

Now let’s view the stack by using the get-location -stack (parameter)
remember (LIFO) last in first out

Type get-location -stack (press return)

Because get-location displays our current location, moby_dick is in the stack but not shown in the stack.

Now from PS C:\books\moby_dick location type popd 

Type get-location -stack (moby_dick) has been removed from the stack)

From PS C:\books\Hamlet location type popd

Type get-location -stack now hamlet has been removed from the stack

From PS C:\books\Gulivers_Travels location type popd 

Type get-location -stack (gulivers travels has been removed from the stack)

From PS C:\books\1984 location type popd

Type get-location -stack (1984 has been removed from the stack)

Type get-location -stack and now the stack is empty.

As you can see we can move between these four folders and easily remove the folders from the stack that are no longer needed.

Server Academy Members Only

Want to access this lesson? Just sign up for a free Server Academy account and you'll be on your way. Already have an account? Click the Sign Up Free button to get started..

0 0 votes
Lesson Rating
Notify of
Inline Feedbacks
View all comments