Tag: command

Azure VM Run Command Run PowerShell Script

How to Run Scripts in your Azure VM using Run Command

You can access your Azure IaaS virtual machine (VM) in multiple ways like SSH or RDP, depending on your operating system and configuration. However, if you have issues with the RDP or SSH network configuration, you need to have a way to troubleshoot your virtual machine (VM). Luckily Azure offers you different management tools to work with Azure VMs for automation or troubleshooting. With the Run Command can run a PowerShell or shell script within an Azure VM remotely by using the VM agent. This scenario is especially useful when you need to troubleshoot operating system network configurations or user access configuration. For example, it can be convenient to reset RDP configurations on Windows Server virtual machines.

You use Run Command for Azure VMs through the Azure portalREST API, Azure CLI, or PowerShell. Here are some examples:

Azure VM Run Command in the Azure Portal

You can run the command directly from the Azure Portal. In the menu of the Azure VM, you can select Run command. Here you can find some predefined scripts to troubleshoot your Azure VM. In the case of a Windows VM, you will find scripts like configuring RDP port or enable PowerShell remoting. But you can also run your custom PowerShell script.

Azure VM Run Command Run PowerShell Script

Azure VM Run Command Run PowerShell Script

For Linux VMs, you will find predefined options to run a Linux shell script or ifconfig to list the network configuration.



Download the new Windows Terminal Preview

How to open Windows Terminal from Command Prompt or Run

This is a really short blog post and more of a reminder than anything else. You might have seen the new Windows Terminal for Windows 10 was just released in the Windows Store as a preview. However, in the last couple of updates to the Windows Terminal app, it got to a state which already makes it my default terminal. The Windows Terminal allows you to run Windows PowerShell, PowerShell Core and even Bash using the Windows Subsystem for Linux (WSL). Especially the integration of the Azure Cloud Shell is a great plus for me. In this blog post, I am just going to show you how you can open the Windows Terminal from command prompt or Run (WIN + R).

To open Windows Terminal from the command line (cmd) or in Windows Run (WIN +R) type:

wt
Open Windows Terminal start wt

Open Windows Terminal start wt

 

If you want to know more about the Azure Cloud Shell integration, read the blog of Pierre Roman (Microsoft Cloud Advocate) on the ITOpsTalk blog.



Windows 10 Task View

The best Windows 10 Features – Why you will love Windows 10

Since the first release of the Windows 10 Preview in the Insider program, I was using the Technical previews on my Surface Pro 3, and it is excellent how Microsoft is improving Windows 10 over the last several months based on research and feedback from the Windows Insider program.

In some days, on July 29, Microsoft will release Windows 10 to the public, and here are some reasons why you will love Windows 10:

Microsoft Edge

Microsoft Edge Browser

With Windows 10 Microsoft released a new browser called Microsoft Edge (before Project Spartan) which is amazingly fast and brings a lot of new features to the table such as Cortana Integration, Web notes which allow you basically draw your notes on websites and share them and Microsoft also promised to enable browser extensions. Secret: you can also switch from a Light Theme to a Dark Theme.

You can also check out the new edge insider preview here: Microsoft Edge Insider

Task View & Virtual Desktop

Windows 10 Task View

Most of the IT Pros reading this blog already knew about Task view in the previous version of Windows using WIN + TAB, but only a few other users did know about these features. Microsoft not only improved the Task view, but Microsoft also promoted it much better with an icon in the Taskbar.

In Windows 10 WIN + TAB does not only offer you Task View it also allows you to create and switch between Virtual Desktops. With Virtual Desktops, you can now finally create multiple workspaces on your PC, which should bring you the productivity boost you need. Secret: You can switch between different Desktops using the Shortcut: CTRL + WIN + ARROW (LEFT and RIGHT).

Hyper-V

Hyper-V vNext Runtime Memory Resize

Microsoft builds Hyper-V directly into the Windows Client since Windows 8. This is great if you want to run Virtual Machines on your Windows Client. Windows 10 Client Hyper-V brings you the excellent performance and features Windows Server 2016 Hyper-V will bring you. Of course, some features are only available in the server build of Hyper-V, but you get some great features such as Enhanced Session mode to copy & paste between your PC and your Virtual Machine. Secret: Windows 10 will allow you to run Hyper-V and use Connected Standby at the same time.



Windows Server Core

Commands for Windows Server Core & Hyper-V Server

For some KTSI projects I have been working a lot with Windows Server Core or Hyper-V Server. Now I had to do a lot of automation, so I made this little connection of commands. If you configure the server manually you can do the most important things with the sconfig utility.

Windows Server Core

Networking

Set Hostname

netdom renamecomputer %COMPUTERNAME% /NewName:<NewComputerName>

Join Domain

netdom join %COMPUTERNAME% /domain:<DomainName> /userd:<UserName> /passwordd:*

Remove Domain

netdom remove

Rename Network Interface

netsh interface set interface name=”old name” newname=”new name”

Configure IP Address

netsh interface ipv4 set address name=<Interface Name>” source=static address=<IPAddress> mask=<SubnetMask> gateway=<DefaultGateway>

Configure DNS Servers

netsh interface ipv4 add dnsserver name=<Interface Name>” address=<DNS Server IP> index=1

Disable Firewall (not recommended)

netsh advfirewall set allprofiles state off

 

Remoting

Enable PowerShell Remoting

Enable-PSRemoting

Enable Remotedesktop

netsh advfirewall firewall set rule group=”remote desktop” new enable=yes

Enable Remote Administration

advfirewall firewall set rule group=”Remote Administration” new enable=yes

Enable Remote Firewall Administration

netsh advfirewall firewall set rule group=”Windows Firewall Remote Management” new enable=yes

Enable ICMP (Ping)

netsh firewall set icmpsetting 8

Enable Remote Disk Management

netsh advfirewall firewall set rule group=”Remote Volume Management” new enable=yes

 

Licensing

Enter License key

slmgr.vbs -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

Activate Windows

slmgr.vbs -ato

 

Windows Update

Enable automatic updates

cscript C:'Windows'System32'Scregedit.wsf /au 4

Disable automatic updates

cscript C:'Windows'System32'Scregedit.wsf /au 1

 

Roles & Features

Get availibale features & roles

Dism /online /get-features /format:table

Enable feature & roles

Dism /online /enable-feature /featurename:<featurename>

 

Basics

Change Administrator password

net user administrator *

Restart Computer

shutdown /r /t 0

Logoff

logoff

More information about Server Core: TechNet



Check NTFS Version

If you need to know which version of NTFS you are using you can do that with the fsutil.exe and the following command.

In my case I am testing my C:\ drive:

fsutil fsinfo ntfsinfo c:

fsutil

More on NTFS Versions on wikipedia.



Run Remote Powershell Commands on multiple standalone Computers

Powershell Header

With this little Powershell Script you can run Powershell Commands on multiple Remotehosts even if those are not in an Active Directory.

# Config
$Servers = @("Server01", Server02)
$Cred = Get-Credential # Add Credentials for all Servers (Domain or non-Domain)
 
# Run Command (for example Get-Service | Where-Object {$_.Name -eq "BITS"}
foreach ($Server in $Servers) {
	Invoke-Command -ComputerName $Server -Credential $Cred {Get-Service | Where-Object {$_.Name -eq "BITS"}}
}

Important:

You have to enable Powershell Remoting on the Remotehost with Enable-PSRemoting



Enable Tiger “Classic” Style Dock In Leopard and Snow Leopard

defaults write com.apple.dock no-glass -boolean NO; killall DockIf you like the old or classic Dock Style from Mac OS X 10.4 you can enable this in Mac OS X 10.5 (Leopard) and in Mac OS X 10.6 (Snow Leopard).

Mac OS X 10.4 (Tiger) Dock:

Mac OS X 10.4 Tiger DockMac OS X 10.6 (Leopard) Dock:

Mac OS X 10.6 Snow Leopard Dock

  1. Open Mac OS X Terminal in the Utilities folder
  2. Run the following command in the Terminal
    defaults write com.apple.dock no-glass -boolean YES; killall Dock
  3. Now you have the classic Dock activated

If you want to activate the new glass Dock again, you can use the following command:

defaults write com.apple.dock no-glass -boolean NO; killall Dock