Tag: PowerShell

Last updated by at .

Nutanix Coding Challenge Total Recode

Judge at the Nutanix Coding Challenge

Nutanix just announced the PowerShell Coding Challenge for your Nutanix environment. The challenge will be to build a script which solves a real world problem in these use cases: Provisioning/orchestration, reporting, data protection, disaster recovery and runbook automation.

Do you have what it takes to write the best script for a Nutanix environment? Find out by participating in the inaugural Total Recode challenge. This global contest gives you a platform for showcasing your best talent. May the most creative, badass coding guru win!

Want to get more familiar with the Nutanix product and test your script? Check out the Nutanix Prism APIs and our recently announced Community Edition software.

Nutanix Coding Challenge Prizes

You can win great prices:

  • Best Overall
    DJ1 Inspire 1 Drone (Valued up
    to $4000) or $4000 cash prize
  • Most Impactful
    Home Lab ($2,500 value)
    or $2,500 cash prize
  • Most Creative
    $2000 cash prize

And I am proud the be a judge in this contest with other great minds:

 

Nutanix Coding Challenge Judges

If you want to know more or join the challenge, check out the Nutantix Coding Challenge: Total Recode website.



Windows 10 IoT Core on Raspberry Pi

Connect the Adafruit 5″ LCD to the Raspberry Pi 2 running Windows 10 IoT Core

First I had connected my TV as an external display for my Raspberry Pi 2 running Windows 10 IoT Core. Since I need the little device for some demos, and I want to take it with me I got a Adafruit 5″ LCD display to connected to the device.

The setup with the display is very easy and just plug and play. Just connect the display to the Raspberry Pi 2 board.

Raspberry Pi 2 LCD Display

But by default the output of the Raspberry Pi 2 is Full HD and so the display setting is kind of wrong. But you change this by editing the config.txt file from the SD card.

Windows 10 IoT Display Config

Just open the SD card and add the folloing lines to the config.txt file. (Source)

Windows 10 IoT Display Config TXT

Now you get the perfect outputfor the 800×480 display. If you want to change the settings while the SD card is in the device it self, you can use PowerShell. Remote connect to the Raspberry Pi 2 using Powershell and navigate to C:\EFIESP and check out the config.txt

You can now set the content of the config.txt file

To have the changes active you have to restart the Windows 10 IoT Core device

 



Windows 10 IoT PowerShell Cred

How to connect to Windows 10 IoT Core via PowerShell

After you have done the setup of your Raspberry Pi 2 with Windows 10 IoT Core you can now connected to the device via PowerShell.

Connect to the Windows 10 IoT device using PowerShell

First open up PowerShell and configure PowerShell remoting to allow your PC to remotely connect to your Raspberry Pi 2. You can use the name of your Raspberry Pi, which is “minwinpc” by default, or you can also using the IP address. You can also use the Windows 10 IoT Core Watcher which helps you find your devices on the network.

You can now open a new PowerShell Remote session by using the following command:

Windows 10 IoT PowerShell Cred

This will prompt you for credentials. The default password of your Pi is “p@ssw0rd

You can also store the credentials inside a variable, so you do not have to enter it all the time:

Windows 10 IoT PowerShell Remoting minwinpc

To create the connection this can take up to 30 seconds. After that you will see the remote session.

Using PowerShell on your Windows 10 IoT Core device

You can now use PowerShell to do some stuff on your Raspberry Pi with Windows 10 IoT Core. Some PowerShell commands are not build in to Windows 10 IoT Core but you can use some command line utilities.

Get all the process running:

Windows 10 IoT PowerShell Processes

Get network adapter configuration:

List the directories:

Rename your computer:

By renaming your device, you have to reconnect and may change your credentials.

Change the password of your administrator:

Shutdown your device

Windows 10 IoT PowerShell Shutdown

Reboot your device

Close your remote session

I hope this helps you to manage your Windows 10 IoT Core device via PowerShell.



Windows 10 IoT Core Raspberry Pi2

How to install the Windows 10 IoT Core on the Raspberry Pi 2

Several months ago Microsoft announced that Windows 10 for the Raspberry Pi 2 will be free. In the last weeks I started working on some Internet of Things (IoT) projects, just to figure out how good the Microsoft story is and how simply I can connect devices for example to Microsoft Azure.

First step in the scenario, I bought my self a Raspberry Pi 2 to start with and checked out the Windows IoT dev center for some more information. Now in this blog post I will describe how you can install Windows 10 IoT Core on your Raspberry Pi 2.

First make sure you have the following things ready:

  • A device running the Windows 10 Insider Preview – must be a physical Windows machine (not a VM).
  • Raspberry Pi 2.
  • 5V micro USB power supply – with at least 1.0A current.
  • 8GB micro SD card – class 10 or better.
  • HDMI cable (if you want to use a display).
  • Ethernet cable.
  • Windows 10 IoT Core Insider Preview Image for Raspberry Pi 2” from Microsoft Connect

After you have download Windows 10 IoT Core for Raspberry Pi 2 copy it to a folder for me this was C:\WindowsIoT. Make sure you have the flash.ffu file in it.

Insert the SD card to your device and open PowerShell  and checkout which disks the SD card is running the following PowerShell commands:

Windows 10 IoT PowerShell DISM Applying Image

Now you can see which disk number is your SD card. This is important for the next command. First navigate to the folder where you have stored the flash.ffu file for me this was C:\WindowsIoT. Now you can run the following command to copy the image to your SD card, change \PhysicalDriveN to the Drive with the disk number in my case this would be \PhysicalDrive1:

Now safely remove your SD card from your PC.

Windows 10 IoT Core Raspberry Pi2

You can now insert the SD card to your Raspberry Pi 2 and connect the network cable, screen via HDMI and the USB power adapter to boot the device up. After you have connected the power supply your device will automatically boot up. On the very first boot Windows 10 IoT Core will do some first boot configurations and it will display a blue default application while this is happening. Wait for a few minutes and the board will automatically restart. This will happen only once and then DefaultApp should show up, displaying the IP address of the Raspberry Pi 2.

Windows 10 IoT Core

I will show you how you can connect to your Windows 10 IoT Core device using PowerShell in another post.



PowerShell

Windows and PowerShell support for SSH

One of the biggest request Microsoft got from customers in terms of PowerShell was that customers want to use Secure Shell protocol and Shell session (aka SSH) to interoperate between Windows and Linux – both Linux connecting to and managing Windows via SSH and Windows connecting to and managing Linux via SSH.

Yesterday Angel Calvo, Group Software Engineering Manager in the PowerShell Team at Microsoft, finally announced that the PowerShell team is going to work, contribute and support the OpenSSH community. This will allow Microsoft to bring SSH (Secure Shell) support for PowerShell in the coming releases. For me connecting from Windows to Linux systems will be a great benefit and helps me manage some of my Azure Virtual Machines from my Surface without having to install any third party tools.

If you want to know more about that check out his Looking Forward: Microsoft: Support for Secure Shell (SSH)

 

 



Windows Server 2012 Logo

Microsoft Nano Server your new Cloud Platform infrastructure Server

Microsoft yesterday announced the availability of Windows Containers and the new SKU for Windows Server vNext named Nano Server. As Microsoft mentions, Nano Server is a purpose-built operating system designed to run born-in-the-cloud applications and containers. But Nano Server is not only designed for Modern Application, but it also is ready and designed to run on your datacenter fabric such as Hyper-V Server and Scale-Out File Server.

Nano Server is a redesign version of Windows Server Core which is very lightweight, very small footprint and remote managed. The first version of Nano Server is designed for the following key scenarios:

  1. Born-in-the-cloud applications – support for multiple programming languages and runtimes. (e.g. C#, Java, Node.js, Python, etc.) running in containers, virtual machines, or on physical servers.
  2. Microsoft Cloud Platform infrastructure – support for compute clusters running Hyper-V and storage clusters running Scale-out File Server.

As mentioned Nano Server has a very small footprint and the first version show some great improvements versus the Windows Server:

  • 93 percent lower VHD size
  • 92 percent fewer critical bulletins
  • 80 percent fewer reboots

To achieved this results Microsoft removed some parts of Windows Server like:

  • GUI stack
  • 32 bit support (WOW64)
  • MSI support
  • RDP
  • Some default Server Core components

By removing the GUI stack makes this server to a true headless server, without any login screen or RDP support. By removing things like this, a lot of people will need a totally new way to manage this servers. The answer is simple and is the best practice for managing servers for a long time called Remote Management. Nano Server will offer some advanced remote Management features such as:

  • WMI
  • PowerShell
  • PowerShell Desired State Configuration
  • RSAT Tools
  • System Center and other Management tools
  • Web-based management tools (to replace local inbox management tools)

In my opinion the effort Microsoft does with Nano Server really makes sense and will help Service Providers as well as Enterprise companies to deploy clouds even faster, more secure, more efficient and with less management overhead. I am really looking forward to Microsoft Ignite to get some more information on Nano Server. If you want to see a little bit more about Nano Server checkout the following video.

 

 



Powershell

Get name of the PowerShell script file inside the script

When you create a script you sometimes want to create some output for a log file for example. In many cases it makes sense to use the script file name for the log file so you can easily see from which .ps1 the .log file was generated for example. To get the name of the PowerShell ps1. file you can use the following command:

This will return the ps1. file object. To get only the name string you could use:

To create a log file with the script file name you could use the following commands: