Start PowerShell as Default in Windows Server Core

Since release of Windows Server 2012 the Windows Server Core version is now the default installation option but I would also say preferred option, here are some reasons why:

  • Reduced attack surface (Fewer system services running, Internet Explorer removed)
  • Reduced memory and disk requirements (Allot smaller footprint)
  • Reduced maintenance (Less Hot fixes that need to be applied)
  • Greater stability (Server Core installation has fewer running processes and services than a Full installation)

Here are some of the Server roles that are supported in Windows Server 2012 R2 Core edition:

  • Active Directory (AD)
  • Active Directory Certificate Services
  • Active Directory Lightweight Directory Services (AD LDS)
  • Active Directory Rights Management Server
  • DHCP Server
  • DNS Server
  • File Services
  • BITS Server
  • BranchCache
  • HyperV
  • Web Server IIS (including a subset of ASP.NET)
  • Windows Server Update Server
  • Print and Document Services
  • Streaming Media Services
  • Routing and Remote Access Server
  • iSCSI
  • Load Balancing
  • MPIO
  • Telnet
  • SQL Server 2012 Database Engine, Analysis Services and Integration Services

So what pisses me of is why “Command Prompt” (cmd.exe) defaults when you are logging on to the Server when most of the administration is done by PowerShell commands.

So how do we change this?

1. Logon to the server

2. On the command prompt type Powershell.exe

3. Type Set-ItemProperty -Path ‘HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon’ -Name Shell -Value PowerShell.exe

4. Logg off and next time you logon again PowerShell will now be started by default

Posted in Windows Server 2012 | Tagged , , , | Leave a comment

Configuration Manager 2012 SP1: smsts.log log location

To troubleshoot your task sequence for errors during OS deployment start looking in the smsts.log. You will probably find the reason why your application or package is not installing as expected or find why configurations you trying to apply are not applying. Depending on where and on what stage you are in the task sequence the smsts.log location depends.

During Windows PE Modes:

Before format and partitioning hard disk: x:\windows\temp\smstslog\smsts.log

After format and partitioning hard disk: x:\smstslog\smsts.log and are then then copied to c:\_SMSTaskSequence\Logs\Smstslog\smsts.log

After OS Applied:

Windows installed but CCM agent not installed: c:\_SMSTaskSequence\Logs\Smstslog\smsts.log

Windows installed and CCM agent installed: c:\windows\system32\ccm\logs\Smstslog\smsts.log

When Task Sequence is complete:

x86 architecture: c:\windows\system32\ccm\logs\smsts.log

x64 architecture: c:\windows\sysWOW64\ccm\logs\smsts.lo

Here are all Log Files locations in Configuration Manager 2012

 

a
Posted in Configuration Manager 2012 | Tagged , , , , , | Leave a comment

ESXi 5 “Critical” snapshot design change

Just want to puke my guts and inform as many as possible about the new snapshot design change that is introduced in ESXi 5. I learn the hard way where my Exchange Server with 1500 mailboxes was down for almost three hours.

So in ESX version 3.x and 4.x all snapshot was by default saved in the virtual machine home directory, by default, the home directory is the same directory as the virtual machine’s .vmx configuration file.

In ESXi 5.xx the new behavior is that snapshots delta files are now are now stored in the same home folder as the base disk, lets for example imagine that we have a VM with five disk witch each resides on each LUN, the new designed change means that the snapshot delta files are now by default created on every LUN and you need to have enough free space on all LUNs assigned to the VM for the snapshot delta files.

Can this be changed, yes but be aware that next time you do Storage vMotion operation, all snapshot deltas will get migrated to the same folder as the VM’s base disk on the destination (So you better make sure you have enough space)

Changing the snapshot file location to the virtual machine working directory in ESXi 5.0?

To modify the snapshot storage location:

  1. Powered off Virtual Machine
  2. Right-click the virtual machine and click Edit Settings.
  3. Click the Options tab.
  4. In the Advanced Options, click General.
  5. Click Configuration Parameters.
  6. Click Add Row.
  7. In the Name field, type snapshot.redoNotWithParent.
  8. In the Value field, type true.

Source

I recommend to read the article released by VMware about the snapshot designed change.

Posted in VMware | Tagged , , , , | 4 Comments

ESXi 5.0 Scripted Install

Here is a nice ESXi 5 install script I use in my own environment; it does most of the job for you. If you want to install ESX host with PXE boot please use a very good guide from Ivo Beerens.

So what does this script do?

  • Install ESXi 5.0 hypervisor
  • Enable and start SSH and ESXi shell
  • Open ports in firewall for vCenter Update Manager, NTP Client and Software iSCSI Client
  • Configures NTP settings
  • Creates and configures Management vSwitch with two nics
  • Creates and configures vMotion vSwitch with two nics
  • Creates and configures iSCSI vSwitch with two nics
  • Enables iSCSI Software Adapter
  • Bonds each VMkernel NICs to the Software iSCSI Adapter
  • Sets CHAP authentication
  • Adds SAN to Dynamic Discovery on iSCSI Software Adapter
  • Enables and sets the default native VMware multipathing driver (Round Robin) for all iSCSI volumes
  • Creates and configures Virtual Machine vSwitch with two nics
  • Add a couple of Virtual Machines Portgroups with different VLANS
  • Renames the local DataStore

Please modify the script after your host configuration but it’s a good template that does most of the job for you.

############# Host Installation #############

# Accept the VMware End User License Agreement

vmaccepteula

# Set the root password

rootpw FreworMate01

# Install on the first local available disk

install –firstdisk –overwritevmfs

# Set the network configuration on the first network adapter

network –bootproto=static –ip=10.150.1.10 –gateway=10.150.1.1 –nameserver=10.150.1.23,10.150.1.22 –netmask=255.255.255.0 –hostname=cen-sv-esx-01.domain.com –device=vmnic0 –addvmportgroup=0

# Reboots the host after the scripted installation is completed

reboot

# Runs second part of the installation after the reboot

%firstboot –interpreter=busybox

################################### Host Configuration ##################################

# Enter maintenance mode

vim-cmd hostsvc/maintenance_mode_enter

# Set DNS names

esxcli system hostname set –fqdn=cen-sv-esx-01.domain.com

esxcli network ip dns search add –domain=domain.com

Continue reading

Posted in VMware | Tagged , , , , , , , , , , , , , , , , , , , | 2 Comments

Exchange 2010: Purge/Remove disconnected mailboxes

Scan all databases for disconnected mailboxes that aren’t yet marked as disconnected in all databases and update the status of those mailboxes in the Exchange store.

Get-MailboxDatabase | Clean-MailboxDatabase

Disabled mailboxes: When a mailbox is disconnected or removed by using the Disable-Mailbox or Remove-Mailbox cmdlet, Exchange retains the deleted mailbox and the mailbox is switched to a disabled state. Disabled mailboxes are retained in the mailbox database until the deleted mailbox retention period expires or until the mailbox is permanently deleted.

Soft-deleted mailboxes : When mailboxes are moved from a Microsoft Exchange Server 2010 Service Pack 1 (SP1) database to any other database, Exchange doesn’t fully delete the mailbox from the source database upon completion of the move. Instead, the mailbox in the source mailbox database is switched to a soft-deleted state. Soft-deleted mailboxes are retained in the source database until either the deleted mailbox retention period expires or until the Remove-StoreMailbox cmdlet is used to purge the mailbox.

Source

Purge “Soft-deleted” mailboxes from specified database. (Be aware that “-Confirm” is set to “False” and you will not get any additional confirmation if you really want to purge all selected mailboxes from the database, changed to “True” if confirmation is needed.)

This command will permanently remove all disconnected mailboxes with “MailboxState” “SoftDeleted” from the database, only way to restore them after this command is with backup.

$Mailboxes = Get-MailboxStatistics -Database “Database-01” | where {$_.DisconnectReason -eq “SoftDeleted”}

$Mailboxes | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted -Confirm:$False}

Purge “Disabled” mailboxes from specified database. (Be aware that “-Confirm” is set to “False” and you will not get any additional confirmation if you really want to purge all selected mailboxes from the database, changed to “True” if confirmation is needed.)

This command will permanently remove all disconnected mailboxes with “MailboxState” “Disabled” from the database, only way to restore them after this command is with backup.

$Mailboxes = Get-MailboxStatistics –Database “Database-03” | Where-Object {$_.DisconnectReason –eq “Disabled”}

$Mailboxes | ForEach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState Disabled -Confirm:$False}

Continue reading

Posted in Exchange 2010 | Tagged , , , , , | 2 Comments

Exchange 2010: Balancing the number of mailboxes and average size across all databases

You might have eight mailbox databases with plenty users created on them randomly, after running some time all mailboxes are now different in size and distributed uneven on all the databases. So has Microsoft any built tool to solve this problem, afraid not but the first step might be Mailbox Database Provisioning witch you can read about “here“.

So what’s the impact not have user on all databases even distributed? Well if you have 400 users that accessing one database instead of 50 users, the database with 50 users will more likely be more responsive and user will eventually have better experience than on the database that is accessed by 400 users if everything else is configured same way. Not always 100% true, it also depend what kind of user activity and how big mailboxes are and so on but you understand the concept.

It could look horrible as this:

(Those stats are gathered with fantastic script from Steve Goodmans’s Exchange blog, please get it “here“) 
 

Here you see for example that we have 65 mailboxes in Database-02 and 471 in Database-6, the average size for a mailbox in Database-02 is 2198MB and in Database-6 346MB, don’t look good ehhh?

So question is how do we solve this?

I haven’t found any cool ems script that both take count for average mailbox size and account of mailboxes in the database so there is some manual steps I’m afraid.

First we need to collect the users stats from all the databases on the server, we are especially interested in mailbox id, size and what database user resides on.

Get-Mailbox –Server “lab3-sv-exm-01” -ResultSize Unlimited | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | select DisplayName, MailboxGuid, {$_.TotalItemSize.Value.ToMB()}, Database | Export-csv -Force -NoType C:\temp\mailboxes.txt

This exports all needed stats to C:\temp\mailboxes.txt 

Now download this Excel file “here

Continue reading

Posted in Exchange 2010 | Tagged , , , , , , , , , | 3 Comments

Exchange 2010: Configure Mailbox Time Zone Settings

View Time Zone settings for a specified user

Get-MailboxRegionalConfiguration “Adam_Bokiniec”


Reset Time Zone settings for a specified user, this will let the user to choose his own Time Zone settings with next Outlook Web App (OWA) login

Set-Mailbox -Identity “Adam_Bokiniec” -Languages $null

Reset Time Zone settings for all users

Get-Mailbox | Set-Mailbox -Languages $null

Set the Time Zone setting for a specified user, to identify the correct syntax for “TimeZone” parameter set the Time Zone” for a user in the OWA and use “Get-MailboxRegionalConfiguration”.

Set-MailboxRegionalConfiguration -Identity “Adam_Bokiniec” -Language en-GB -DateFormat “dd/MM/yyyy” -TimeFormat “HH:mm” -TimeZone “W. Europe Standard Time”

Set the Time Zone settings for all users

Get-Mailbox | Set-MailboxRegionalConfiguration -Language en-GB -DateFormat “dd/MM/yyyy” -TimeFormat “HH:mm” -TimeZone “W. Europe Standard Time”

Set the Time Zone settings for specified OU

Get-Mailbox -OrganizationalUnit “adatum.com/Users” | Set-MailboxRegionalConfiguration -Language en-GB -DateFormat “dd/MM/yyyy” -TimeFormat “HH:mm” -TimeZone “W. Europe Standard Time”

Set default client language for Outlook Web App (OWA) for all users, here you need to use Language Codes witch can be found here: http://technet.microsoft.com/en-us/library/aa997435.aspx. Once the default client language is specified when the users try to login for the first time in OWA, they are not prompted to choose a language and OWA Time Zone is picked up from the time zone of Client Access Server.

Set-OWAVirtualDirectory “OWA (Default Web Site)” -DefaultClientLanguage 2057

This was tested on Exchange SP1

Posted in Exchange 2010 | Tagged , , , , , | 1 Comment