Showing posts with label server 2008 core. Show all posts
Showing posts with label server 2008 core. Show all posts

Sunday, 9 March 2014

PowerShell shutdown all running Hyper-V VMs

PowerShell Script that shuts down all running virtual machines on named Hyper-V server. It shuts them down one at a time waiting while a VM shuts down before shutting down the next. Remember to substitute your <servername>. Quick way to shutdown the test environment at the end of the day.

$runningVM=Get-VM –ComputerName <servername> | Where-Object {$_.State -eq 'Running'}

foreach($cn in $runningVM){
Write-Host "Shutting down $($cn.name)"
stop-vm $cn.name -force
}

Add the following lines to shut down the Hyper-v server

Write-Host "Shutting down Hyper-V server”

Stop-Computer –computername <servername> –force

Saturday, 8 March 2014

Auto load PowerShell Window in Server Core

When working with a server core I like to have a PowerShell window open. Here is a quick way to do it.

You could just type PowerShell in the cmd window to turn it into a PowerShell window or type Start PowerShell to open a separate PowerShell window.

To have it there waiting for you:

  1. From cmd prompt run Regedit
  2. Navigate to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
  3. Add string Value called PowerShell with value cmd.exe /k %windir%\system32\WindowsPowerShell\v1.0\powershell.exe.

Alternatively use the PowerShell Command

New-ItemProperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\run -Name PowerShell -Value C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -Type string

Saturday, 15 February 2014

Refresh Hosts file without rebooting

Tried this with Windows 8.1 and it is easier than you would think as it a command you should be very familiar with.

IPCONFIG /FLUSHDNS

Sunday, 21 April 2013

Remote Server Manager on Server 2008 R2 Core

I have a long standing Hyper-V test environment running on Server 2008 R2 core. Recently decided to try Server Manager remotely from a Windows 7 machine to manage the 2008 Core.

Both machines are in the same workgroup and successfully configured for Remote Desktop. The Remote Server Administration Tool for Windows 7 are installed.

Run Server Manager on Windows 7 then try connecting to Hyper-V server and I get this error:

image

TechNet: Remote Management with Server Manager

On Hyper-V Server

Ensured that I had done the following

  • From sconfig.cmd
  • selected 4) Configures Remote Management the server 
  • then 3) Allow Server Manager Remote Management

this had no effect on the error there was no need to reboot the server as I had already installed PowerShell but did so anyway but still could not connect with Server Manager

On Windows 7 Client

net start winrm

winrm set winrm/config/client @{TrustedHosts="RemoteComputerName"}

Replace RemoteComputerName with server name

This failed on initial attempt

I should have run the following command first because machines where in workgroup not domain.

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

Running the winrm command again and Server Manger could connect to my Hyper-V server.

Still got errors on Server Manager components but a step forward.

Device Manager Error

image

Resolution Enable Remote Access to Device Manager

See this very useful blog post

Enabling Remote Access to Device Manager on Server Core

Virtual Disk Management Error

image

Resolution Windows 7 Firewall

Inbound rules on Windows 7 needed to be set

Remote Volume Management - Virtual Disk Service (RPC)

Remote Volume Management - Virtual Disk Service Loader (RPC)

Friday, 4 January 2013

Disable password complexity Hyper-V 2008 R2

Disabling password complexity requirements on Hyper-V Server 2008 R2

Other useful things to investigate:

Type net accounts at a command prompt on the Hyper-V terminal will display current password policy settings.

image

I use net accounts /maxpwage:unlimited to prevent my password expiring in my test environment … just out of pure laziness.

image

Net Accounts

Updates the user accounts database and modifies password and logon requirements for all accounts.

http://technet.microsoft.com/en-us/library/bb490698.aspx

Wednesday, 24 October 2012

Windows Server 2008 Core Installation Step-by-Step Getting Started Guide

Server Core Installation Option Getting Started Guide

Microsoft step-by-step guide on installation, initial configuration, and managing a server that is running a Server Core installation.

Hyper-V getting the command console back.

Did you just click X and blow away the command line console leaving you with just a very unfriendly blue background!!!

Press Ctrl+Alt+Del

Select Task Manager

Select New Task

Enter CMD

You should now have a fresh instance of command console running.

Windows Server 2008 Webcasts

Warning:

Some of the links mentioned in these webcasts no longer exist as Microsoft is in Server 2012 mode.

Those of you who have been through previous Microsoft product releases will be aware that they go into sales mode and that previous version don’t seem to exist anymore.

I will try to include any useful remaining links such as contributors blogs.

24 Hours of Windows Server 2008

TechNet Webcast: 24 Hours of Windows Server 2008 (parts 01 to 24)

(level 200)

Blogs of contributors to this series

Keith Combs' Blahg

Kevin Remde's IT Pro Weblog

Chris Avis Blog

Prepare Yourself for Windows 2008

TechNet Webcast: Prepare Yourself for Windows Server 2008 (Parts 01 to 08)

Thursday, 19 November 2009

Hyper-v USB pass through drive

What is a pass through drive?
Add the USB HDD to a VM as a pass-through disk
Diskpart Command-Line Utility

The VM must be shutdown to attach pass through disk
wbadmin get disks - get disks currently online

References:
How to do a USB HDD pass through to a VM
A Description of the Diskpart Command-Line Utility
Configuring Pass-through Disks in Hyper-V

Tuesday, 17 November 2009

Windows 2008 Server Core enabling remote management

This is part of a series of bloggs written while installing Windows 2008 SBS Premium as VMs on Hyper-V.


Remote management of Windows Server 2008 Core from  a Windows Vista Workstation.
Microsoft recomendation is not to have the windows core/hyper-v server in the same domain as the Virtual Machines (VMs) so I leave the hyper-v server and managment workstation in a workgroup. The Vista workstation must be at least Service Pack 1.


If you may wish to create a seperate management domain for core server and managment workstation rember to do so before setting the firewall rules. Firewall rules are lost when the server is moved from a workgroup to domain.


Reboots are required after some steps ... still to update the documentation.


Configuring firewall rules on Core and Vista
netsh advfirewall firewall set rule group="Remote Administration" new enable=yes
netsh advfirewall firewall set rule group="Remote Volume Management" new enable=yes


last command needs to be run on Vista workstation as well make certain that the command prompt has been elevated to admin.


sc config vds start= auto (note the space is reqired between = and auto)
net start vds


Hyper-V server and client in same workgroup or DCOM Remote Access enabled
On the client run the following
cmdkey /add:targetname  /user:user_name  /password:user_password
cmdkey /delete:targetname
(cmdkey not avaliable on XP but windows 2003 version can be installed ... will blog this later)

DCOM Remote Access
If the hyper-v server is in a different workgroup or domain that the client ... setting DCOM Remote Access permission on the client.
  • Run DCOMCNFG
  • In the Component Services dialog box, expand Component Services, expand Computers, and then right-click My Computer and click Properties.
  • In the My Computer Properties dialog box, click the COM Security tab.
  • Under Access Permissions, click Edit Limits.
  • In the Access Permission dialog box, select ANONYMOUS LOGON name in the Group or user names box. In the Allow column under Permissions for User, select Remote Access, and then click OK.

Windows 2008 Server Core Local Settings

Managing Server Core Local Settings From Command Line
Windows Server 2008 Core installation does not include the graphical user interface (GUI) and can only managed locally from a command prompt.

start /w
  • net
  • netdom
  • netsh
    • Netsh advfirewall firewall set rule group=”” new enable=yes
  • ocsetup
  • pnputil
  • sc
  • shutdown
  • taskkill
  • wevtutil
  • wbadmin
  • wmic

Usefull ocsetup commands

post to follow
start /w ocsetup

Usefull wbadmin commands

wbadmin [] [-backupTarget:{VolumeName NetworkSharePath}][-machine:BackupMachineName]

List the disks that are currently online for the local computer
WBADMIN GET DISKS

Backup c: drive
WBADMIN START BACKUP -backupTarget:e: -include:c: -quiet

Create a backup of the system state
WBADMIN START SYSTEMSTATEBACKUP -backupTarget:e: -quiet

e:\WindowsImageBackup\[machinename]
It is possible to backup multiple machines using the same external drive

In the case of Hyper-V Virtual Machines you have to shutdown the VM to switch external drives.
The limiting factor is that both the source and target drives have to be locally attached.
In the case of SBS 2008 Premium where you use 2 VMs you would want 2 external usb drives. If you have a larger number of VMs that require backup an alternative solution is desirable.

See blog about setting up pass through drives for use with VMs.

Used in conjunction with the Windows Server Backup GUI it is possible to restore backups for this or other machines. You can also backup the machine from the GUI.

See blog about setting up Windows Server Backup on Windows 2008.

Running from a batch file & scheduling
Create file c:\backserver.cmd with following contents
wbadmin start backup -backupTarget:e: -allCritical -quiet

open command prompt and enter the following to schedule the backup
at 21:00 /every:M,T,W,Th,F c:\backserver.cmd

These commands will backup the system drive, including system state, at 9pm every week day