I am starting to work more with VS Code, especially since it is so easy now to write PowerShell code on my MacBook Pro, without having to switch to a Windows VM or remote into a Windows machine.

Yet there a few kinks, they are however easy to fix.

  1. Install Powershell on the macOS
    So easy! Go to: https://github.com/PowerShell/PowerShell/releases/
    Download the latest PowerShell package for macOS
    (It’s the one ending with .pkg)
    Allow the package to be run:
    System Preferences -> Security & Privacy -> Allow Apps downloaded from
    Follow the prompt
    Done.
  2. Installing the Powershell Extension
    Press ‘Shift+CMD+P’ to open the Command Palett
    Type ‘Install Extensions’, select it and press enter
    Type in PowerShell, there is currently only a single extension from Microsoft for PowerShell, so that’s the one you should pick.
    Click on Install/Enable, restart VS Code, done.
  3. PowerShell Intellisense issues
    It seems to be common issue if there is no OpenSSL installed
    Have a read here how to fix it.
  4. Another issue is PowerShell remoting. Since Windows is using win RM, macOS or Linux know nothing about that. You have to use SSH, specifically OpenSSH. You have to install that on your windows machine which is right now a little bit tricky (step by step here) but eventually they are going to build a cmdlet or something to automate that for you.

Well, going forward, with the movement of PowerShell being Opensource, it seems the ISE is no longer going to be the ‘main’ PowerShell development platform, but Visual Studio Code, which is a free, open source, multi-platform (Windows, Linux, macOS) code editor from Microsoft.

Late last year  it was announced that VS Code would get Powershell support, which is pretty awesome as you can not develop and administer PowerShell task from your Linux or Mac machine. The only drawback to it is, PowerShell is limited to PowerShell Core. On the bright site, that is super as Nano server is using PowerShell core as well.

 

Yay bash! Still have not found a good powershell replacement for grep… sure there is ‘select-string’ but meh…

Anyways how to install bash on Windows 10:

  1. Make sure you have the right version of Windows 10 and the Anniversary Update installed!
  2. Start -> Settings -> Update & Security -> For Developers -> Activate Developer Mode
  3. Go with Programs and Features (appwiz.cpl) and click on ‘Turn Windows features on or off’
  4. You should now see “Windows Subsystem for Linux (Beta)
  5. Install it and run bash
  6. Now the most frustrating part, you have to sign in to the windows store and accept the TOS
  7. Once finished you should have “Bash on Ubuntu on Windows”
  1. Install Python 2 ( download it from here )
    [See bottom notes about why Python 2, not 3].
  2. Open PowerShell and type python
  3. If you get an error define the environment variable to know about python

    Close PowerShell and open it again and try python again.

    If done right, you should see something like this:
    pythonHooray, we have Python 2 now installed.
    To exit Python you can type exit()

Note: Why Python 2 vs Python 3 to get started:

A programmer may try to get you to install Python 3 and learn that. Say, “When all of the Python code on your computer is Python 3, then I’ll try to learn it.” That should keep them busy for about 10 years. I repeat, do not use Python 3. Python 3 is not used very much, and if you learn Python 2 you can easily learn Python 3 when you need it. If you learn Python 3 then you’ll still have to learn Python 2 to get anything done. Just learn Python 2 and ignore people saying Python 3 is the future.

Source: https://learnpythonthehardway.org