Category: Windows 7

cmd clip

Pipe cmd prompt commands into the clipboard

This is a very all but very useful command if you work with the Windows Command Prompt. This allows you to output text from commands into the Windows clipboard.

 
dir | clip

Scott Hanselman from Microsoft just reminded the community about this feature, which is available in Windows since Windows Vista.

PowerShell v5 got some similar command using Set-Clipboard and Get-Clipboard.

 
Set-Clipboard
 
Get-Clipboard


unatted xml file for VM

Add unattend.xml to VHDX File for VM automation

If you for example don’t have System Center Virtual Machine Manager or another tool to create Virtual Machine Templates and automate the deployment, you can also do this using Sysprep, PowerShell and an unattend.xml file to automate or simplify the Virtual Machine creation process. In other blog posts I already wrote how you can sysprep Virtual Machines or how you can create Hyper-V Virtual Machines using PowerShell. In this post I will show you how you can add an unattend.xml file to your VHD or VHDX so your virtual machine gets some default settings like regional information.

Here we have a basic unattend.xml file. If you want to enhance it, or create your own, you can also use the Windows ADK.

To use this unattend.xml you first have to sysprep a virtual machine and create a sysprep VHD file. After that you can mount the VHDX file and insert the unattend.xml file to the VHD. Copy the unattend.xml file to the following location: D:\Windows\Panther (in my case the VHD was mounted as D drive).

You can mount the VHDX using the UI or PowerShell:

 
Mount-VHD .\VHDFile.vhdx
 
Copy-Item .\unattend.xml -destination D:\Windows\Panther\
 
Dismount-VHD .\VHDFile.vhdx

There are more paths as well. You can check out the Windows Setup Automation Overview on TechNet where you can see all the possible paths to place the unattend.xml file.



Get-NetIPConfiguration

Basic Networking PowerShell cmdlets cheatsheet to replace netsh, ipconfig, nslookup and more

Around 4 years ago I wrote a blog post about how to Replace netsh with Windows PowerShell which includes basic powershell networking cmdlets. After working with Microsoft Azure, Nano Server and Containers, PowerShell together with networking becomes more and more important. I created this little cheat sheet so it becomes easy for people to get started.

Basic Networking PowerShell cmdlets

Get-NetIPConfiguration

Get the IP Configuration (ipconfig with PowerShell)

Get-NetIPConfiguration

List all Network Adapters

Get-NetAdapter

Get a spesific network adapter by name

Get-NetAdapter -Name *Ethernet*

Get more information VLAN ID, Speed, Connection status

Get-NetAdapter | ft Name, Status, Linkspeed, VlanID

Get driver information

Get-NetAdapter | ft Name, DriverName, DriverVersion, DriverInformation, DriverFileName

Get adapter hardware information. This can be really usefull when you need to know the PCI slot of the NIC.

Get-NetAdapterHardwareInfo

Disable and Enable a Network Adapter

Disable-NetAdapter -Name "Wireless Network Connection"
Enable-NetAdapter -Name "Wireless Network Connection"

Rename a Network Adapter

Rename-NetAdapter -Name "Wireless Network Connection" -NewName "Wireless"

IP Configuration using PowerShell

PowerShell Networking Get-NetIPAddress

Get IP and DNS address information

Get-NetAdapter -Name "Local Area Connection" | Get-NetIPAddress

Get IP address only

(Get-NetAdapter -Name "Local Area Connection" | Get-NetIPAddress).IPv4Address

Get DNS Server Address information

Get-NetAdapter -Name "Local Area Connection" | Get-DnsClientServerAddress

Set IP Address

New-NetIPAddress -InterfaceAlias "Wireless" -IPv4Address 10.0.1.95 -PrefixLength "24" -DefaultGateway 10.0.1.1

or if you want to change a existing IP Address

Set-NetIPAddress -InterfaceAlias "Wireless" -IPv4Address 192.168.12.25 -PrefixLength "24"

Remove IP Address

Get-NetAdapter -Name "Wireless" | Remove-NetIPAddress

Set DNS Server

Set-DnsClientServerAddress -InterfaceAlias "Wireless" -ServerAddresses "10.10.20.1","10.10.20.2"

Set interface to DHCP

Set-NetIPInterface -InterfaceAlias "Wireless" -Dhcp Enabled

Clear DNS Cache with PowerShell

You can also manage your DNS cache with PowerShell.

List DNS Cache:

 
Get-DnsClientCache

Clear DNS Cache

 
Clear-DnsClientCache

Ping with PowerShell

PowerShell Networking Test-NetConnection Ping

How to Ping with PowerShell. For a simple ping command with PowerShell, you can use the Test-Connection cmdlet:

 
Test-Connection thomasmaurer.ch

There is an advanced way to test connection using PowerShell

Test-NetConnection -ComputerName www.thomasmaurer.ch

Get some more details from the Test-NetConnection

Test-NetConnection -ComputerName www.thomasmaurer.ch -InformationLevel Detailed

Ping multiple IP using PowerShell

1..99 | % { Test-NetConnection -ComputerName x.x.x.$_ } | FT -AutoSize

Tracert

PowerShell Tracert

Tracert with PowerShell

Test-NetConnection www.thomasmaurer.ch –TraceRoute

Portscan with PowerShell

PowerShell Portscan

Use PowerShell to check for open port

Test-NetConnection -ComputerName www.thomasmaurer.ch -Port 80
Test-NetConnection -ComputerName www.thomasmaurer.ch -CommonTCPPort HTTP

NSlookup in PowerShell

PowerShell Networking NSlookup

NSlookup using PowerShell:

Resolve-DnsName www.thomasmaurer.ch
Resolve-DnsName www.thomasmaurer.ch -Type MX -Server 8.8.8.8

Route in PowerShell

PowerShell Networking Route

How to replace Route command with PowerShell

Get-NetRoute -Protocol Local -DestinationPrefix 192.168*
Get-NetRoute -InterfaceAlias Wi-Fi
 
New-NetRoute –DestinationPrefix "10.0.0.0/24" –InterfaceAlias "Ethernet" –NextHop 192.168.192.1

NETSTAT in PowerShell

PowerShell Networking Netstat

How to replace NETSTAT with PowerShell

Get-NetTCPConnection
Get-NetTCPConnection –State Established

NIC Teaming PowerShell commands

Create a new NIC Teaming (Network Adapter Team)

New-NetLbfoTeam -Name NICTEAM01 -TeamMembers Ethernet, Ethernet2 -TeamingMode SwitchIndependent -TeamNicName NICTEAM01 -LoadBalancingAlgorithm Dynamic

SMB Related PowerShell commands

SMB PowerShell SMB Client Configuration

Get SMB Client Configuration

Get-SmbClientConfiguration

Get SMB Connections

Get-SmbConnection

Get SMB Mutlichannel Connections

Get-SmbMutlichannelConnection

Get SMB open files

Get-SmbOpenFile

Get SMB Direct (RDMA) adapters

Get-NetAdapterRdma

Hyper-V Networking cmdlets

Hyper-V PowerShell Get-VMNetwork Adapter

Get and set Network Adapter VMQ settings

Get-NetAdapterVmq
# Disable VMQ
Set-NetAdapterVmq -Enabled $false
# Enable VMQ
Set-NetAdapterVmq -Enabled $true

Get VM Network Adapter

Get-VMNetworkAdapter -VMName Server01

Get VM Network Adapter IP Addresses

(Get-VMNetworkAdapter -VMName NanoConHost01).IPAddresses

Get VM Network Adapter Mac Addresses

(Get-VMNetworkAdapter -VMName NanoConHost01).MacAddress

I hope you enjoyed it and the post was helpful, if you think something important is missing, please add it in the comments.



Veeam FastSCP for Microsoft Azure

Veeam FastSCP for Microsoft Azure

Veeam does some great products for your virtualization and datacenter environment such as their Veeam Backup & Replication suite, Veeam Endpoint Backup FREE and Management Packs for System Center Operations Manager. Now a couple of weeks ago Veeam released a cool free tool call Veeam FastSCP fro Microsoft Azure. With Veeam FastSCP (Secure Copy Protocol) for Microsoft Azure, IT Pros and Azure Developers can simply and reliably copy local files to Azure VMs, and copy files in Azure VMs to on-premises.

Veeam FastSCP for Microsoft Azure Diagram

The utility makes your life way easier when dealing with Virtual Machines running on Microsoft Azure IaaS.

  • Secure file copy with no independent encryption or VPN needed
  • Manual file copy to/from Azure VMs without the need to keep the UI open until the file copy completes
  • Automatic scheduling of file copy jobs for nightly or weekly copies to/from Azure VMs
  • A wizard-driven UI to copy files in just a few clicks – with no scripting needed

If you want to download it, check out the Veeam Website.

To set it up the tool connects to the PowerShell endpoint for your IaaS VM. Just add the Virtual Machine and you are ready to go! With that you can do some great things, like simply copy a file to an Azure IaaS VM or even doing scheduled backups of files from inside Azure VMs like Didier Van Hoye did.

 

 



Xbox Music

12 reasons to use Xbox Music

This week Apple launched their own music streaming service called Apple Music to compete with others like Spotify and other services. One service which is not really known by the public is Microsoft Xbox Music, which is not only a streaming service but also has a bunch of other features as well.

The all-in-one music service

Xbox Music allows you to buy songs and albums or subscribe to Xbox Music Pass for unlimited access all your devices. Xbox Music is the only service that brings you millions of songs to discover, stream, download and own for your tablet, PC, Xbox phone, and the Web. It’s all the music you love, every way you want it

Xbox Music Pass

Xbox Music Pass

With Xbox Music Pass, get unlimited access to millions of songs. Stream or download as much as you like. Listen on your PC, tablet, phone, Xbox, and on the web. The Xbox Music Pass costs $9.99/Month and comes with a 30 days free trial.

Xbox Music Pass Features

Music across all your devices

Xbox Music Andorid Xbox Music iOS

Xbox Music works on your PC, tablet, Xbox 360, Xbox One, the web, and your phone, including Windows Phone, iOS, and Android devices.

Sync all your playlists across your devices

Using the Xbox Music service does sync all your playlists on all your devices over the air. No more syncing devices using cables.

Offline Available

You can not only stream songs to your devices, you can also download them to listen offline. This is perfect when you are on a plane or somewhere where you don’t have internet access.

Stream your own music from OneDrive

Xnox Music OneDrive

With Xbox Music and OneDrive you can stream your own music you already own on every device directly from OneDrive. Just upload your songs to the OneDrive Music folder and they will be available on all your devices.

Xbox Music Webplayer

Xbox Music Web Player

If you are not using your own computer, or you have a device where Xbox Music isn’t installed, you can simply logon to the Xbox Music Web Player to play songs in the web browser. This is perfect when you are the your friends computer and want to play some of your favorite playlists.

Radio Stations

If you like a song or an artists and you want to discover similar music you can simply use the Radio feature, which creates custom stations based on the artists you love.

My Music

Xbox Music not only works with streamed songs, it also manages music on your local devices as well. Easily manage and play all of the music from your collection right in the Xbox Music app, including songs purchased from iTunes or other services, playlists created with Xbox Music, or albums ripped from CD’s.

Xbox Music Store

The Xbox Music Store gives you 24/7 access to one of the largest music catalogs on the planet with over 18 million songs. Buy full albums or just your favorite songs.

Unlimited skipping

With an Xbox Music Pass subscription, enjoy unlimited skipping when listening to radio stations.

Windows 10 and Windows 10 Mobile

Xbox Music Universal App 2

With Windows 10 and Windows 10 Mobile, launches a new cool Universal Windows App for all your Windows devices.

 

 



Windows 10 Product Familiy

Windows 10 Editions and upgrade paths

Last week Microsoft announced the different editions of Windows 10. As in the past Microsoft offers Windows in different editions that are tailored for various different use cases and scenarios. Windows 10 will power an broad range of devices – everything from PCs, tablets, phones, Xbox One, Microsoft HoloLens and Surface Hub. It will also power the world around us, core to devices making up the Internet of Things, everything from elevators to ATMs to heart rate monitors to wearables.

Editions

The different Windows 10 editions address specific needs of our various customer groups, from consumers to small businesses to the largest enterprises.

  • Windows 10 Home – Windows 10 Home is the consumer-focused desktop edition.
  • Windows 10 Mobile – Windows 10 Mobile is designed to deliver the best user experience on smaller, mobile, touch-centric devices like smartphones and small tablets.
  • Windows 10 Pro – Windows 10 Pro is a desktop edition for PCs, tablets and 2-in-1s. Building upon both the familiar and innovative features of Windows 10 Home, it has many extra features to meet the diverse needs of small businesses. Windows 10 Pro will add some management capabilities to the Windows 10 and also adds Windows Update for Business.
  • Windows 10 Enterprise – Windows 10 Enterprise builds on Windows 10 Pro, adding advanced features designed to meet the demands of medium and large sized organizations. Windows 10 Enterprise will be available to Volume Licensing customers and adds some features such as Direct Access, Branch Cache and Windows Update for Business. With Windows 10 Enterprise customers will also get access to the Long Term Servicing Branch to better control deployment options for future updates.
  • Windows 10 Education – Windows 10 Education builds on Windows 10 Enterprise, and is designed to meet the needs of schools – staff, administrators, teachers and students. This edition will be available through academic Volume Licensing, and there will be paths for schools and students using Windows 10 Home and Windows 10 Pro devices to upgrade to Windows 10 Education.
  • Windows 10 Mobile Enterprise – Windows 10 Mobile Enterprise is designed to deliver the best customer experience to business customers on smartphones and small tablets. It will be available to our Volume Licensing customers. Windows 10 Mobile Enterprise will adds a flexible ways for businesses to manage updates.
  • Windows 10 IoT  – Windows 10 will also be avaialble for different industry devices like ATMs, rteail point of sale, handheld terminals and industrial robotics and as well for IoT (Internet of Things) devices with a Windows 10 IoT Core edition.

Upgrade

As Microsoft  announced in January this year, for the first time ever, Microsoft is offering the full versions of Windows 10 Home, Windows 10 Mobile and Windows 10 Pro as a free and easy upgrade for qualifying Windows 7, Windows 8.1 and Windows Phone 8.1 devices that upgrade in the first year after launch. Once you upgrade, you have Windows 10 for free on that device. In the Microsoft Partner Network Microsoft published some more information about the upgrade paths.

Microsoft will offer a free upgrade to Windows 10 for qualified Windows 7, Windows 8 and Windows Phone 8.1 devices in the first year. After the first year, upgrades will be paid via boxed product and VL Upgrades.

  • Windows 8/8.1 and Windows 7 Home Basic and Home Premium devices upgrade to Windows 10 Home
  • Windows 8/8.1 Pro and Windows 7 Professional and Ultimate devices upgrade to Windows 10 Pro
  • If upgraded within the first 12 months following launch, the device will receive ongoing Windows 10 updates for free for the life of that device
  • Excludes Windows Enterprise and RT devices
  • The free Windows 10 upgrade is delivered through Windows Update; domain-joined machines can manually get the update via Windows Update. The upgrade cannot be deployed through WSUS.

Windows Update for Business

At Ignite, Microsoft  announced the free Windows Update for Business service, available for all Windows Pro and Windows Enterprise devices, designed to help organisations keep their Windows devices always up to date with the latest security and features. In case you missed it, check out the blog, Announcing Windows Update for Business for what the service will provide.



PowerShell

Get name of the PowerShell script file inside the script

When you create a PowerShell 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 from MyInvocation:

$MyInvocation.MyCommand

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

$MyInvocation.MyCommand.Name

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

$path = Get-Location
$scriptName = $MyInvocation.MyCommand.Name
$scriptLog = "$path\$scriptName.log"