• Home
  • About
  • Contact
  • Resources
  • News
  • Home
  • About
  • Contact
  • Resources
  • News
Powershell Newbie

Get | Set | Start

Get-Verb

2/16/2018

2 Comments

 
So we have looked at using Get-Help and Get-Command to discover Cmdlets and how to use them, but there is another tool we can add to the mix. Get-Verb will display the long list of standard verbs. I say standard, because you can create scripts or functions and use whatever bad choice you like :). It is always best to stick with the standards. It keeps it conformed, organized, and makes sense to those you may decide to share with. Sharing is good. So try Get-Verb today and you might find some verbs you were unaware of being available. Then you can use Get-Command or Get-Help to look up some existing Cmdlets that use those verbs.
Picture
Picture
Get-Verb also outputs the group to which the verb belongs. This is nice for categorizing the type of functionality.
2 Comments

PS in Linux in PS

2/1/2018

1 Comment

 
The usefulness could be debated but this sure was fun to accomplish. The result is a PowerShell Core console inside a Kali Linux terminal running in a Windows PowerShell console. Pictures follow.

First I followed the instructions from the Kali blog here:
Installing Kali Linux on Windows 10 Using the Linux Subsystem

Next within that Kali subsystem I followed the instructions from Microsoft here:
Installing PowerShell Core On macOS and Linux       
I scrolled down to the section:
Installation via Package Repository - Debian 9
But...
Ran into a DNS issue. This is solved by using nano editor in linux to change the DNS file:
​nano /etc/resolv.conf
then Ctrl+O to save and Ctrl+X to exit
I then had no trouble following the instructions and once done...BAM!
PowerShell Core inside Kali Linux inside Windows PowerShell on Windows 10
Why did I do it? Because I could. If we don't test it, we won't break it. If we don't break it, we miss an opportunity to learn.
Picture
Picture
Picture
Picture
Picture
Picture
Picture
Picture
Picture
Picture
1 Comment

Utilize your Profile to Learn

1/31/2018

1 Comment

 
Insert this one liner into your PowerShell profile script to get a random about entry from the help system each day when you open your console. First find your profile.ps1 file and open it. You can simply use the built in $PROFILE variable to find the file.
Picture
Or you can go straight to opening it by typing "notepad $profile" and pressing enter.
Then add this line to the script:
get-random (get-help "about_*") | help
save the file, exit notepad, then open a new PowerShell console.
You should be presented with a random about file describing a topic in PowerShell. If you close PowerShell and open it everytime you run commands instead of leaving it open, it can get old real quick. However, for learning the mechanics this is a great tool. To stop it, go through the same process and remove that line from your profile.ps1 script.
1 Comment

Course now published

1/23/2018

2 Comments

 
Picture
The course is officially published and available for immediate viewing! If you purchase it make sure to contact me and let me know. I will make sure I am available to support you on your journey with PowerShell. You can find the course here: Learning PowerShell 6
2 Comments

Help for Help

1/23/2018

1 Comment

 
When starting out, help can be overwhelming. It is well made and laid out, but at first can be intimidating. One way to begin to overcome unfamiliarity with help regarding Cmdlets and how they run, is to use help. Yes, help for help. At the PowerShell prompt run "Help about_command_syntax". This will provide an excellent documentation included with PowerShell regarding what all the "stuff" in a Cmdlet's help file means. I recommend reading through this at least a few times in the beginning and refer back to it when a related question pops up. The "about" help entries can be some of the most helpful included (pun intended).
Picture
1 Comment

Naming Your Scripts

1/16/2018

1 Comment

 
It is a good practice to check for an existing command that may have the name or a similar name to a script you are saving. To do this, use Get-Help and Get-Command to search for matches.
Picture
In this instance, i searched new-vm because i am writing a script to create a new VM for my lab. Since I have Hyper-V installed, I already have a Cmdlet named New-VM.
At this point you need to ask yourself is the existing Cmdlet good enough to do what I want or what sets my script apart. The answers here will help you name your script. In my case the main difference is it being for my lab. Therefore, I will name my script New-LabVM and avoid conflicts.
1 Comment

Course now Available for Pre-Order!

1/12/2018

1 Comment

 
Picture
This course is a great resource for beginners to grasp the fundamentals of PowerShell. It's fast, it's packed, and It's only $5 for a limited time. If you buy it, let me know. My desire is to be available on your journey getting started with PowerShell. I am always happy to answer any questions along the way.
1 Comment

New Lab Setup Guide Available

1/7/2018

0 Comments

 
The best way to learn PowerShell is to use it. The safe way to practice and experiment is in a lab. Combine both with my new guide to setting up a lab using a computer with Windows 10 Pro. If you don't have the Pro edition, it is available as an upgrade from Microsoft.
​In the guide you get to use PowerShell to install Hyper-V, setup your virtual network, and create the virtual machines. Then you get to use PowerShell in each virtual machine to setup a corporate network, join machines to the domain, and more!
Download the guide today and let me know if you have any thing I should add to it.
​
windows_server_lab_setup_using_powershell.pdf
File Size: 562 kb
File Type: pdf
Download File

0 Comments

What Version of PowerShell Do You Have?

1/6/2018

0 Comments

 
Determining the version of PowerShell you are using is easy with a built in variable. Simply type $PSVersiontable and press enter to find out.
Picture
The output shows us our PSVersion or PowerShell version. Note the PSEdition states Desktop. If you have installed a core version onto Linux or another platform you will get an output something like this:
Picture
0 Comments

PSDrives

1/2/2018

0 Comments

 
PowerShell uses PSDrives that work and include your file system drives. To locate the available use the Get-PSDrive Cmdlet:
Picture
Notice the Alias drive. You can navigate to these drives as you would a file system drive:
cd alias:
Now you can type dir to get a list of aliases.
Try doing the same with the Env: drive. It allows you to browse the environmental variables drive. Or the HKLU and HKLM which allow for navigation through the registry. Just be careful. Better yet do this on a virtual machine in a test environment and feel free to experiment.
​Happy navigating!
0 Comments
<<Previous

    Joshua B. Jones, VCP6-DCV

    Professional PowerShell Fan, Automation & Virtualization Expert

    Archives

    February 2018
    January 2018
    December 2017
    November 2017
    May 2017
    August 2016

    Categories

    All

    RSS Feed

Powered by Create your own unique website with customizable templates.