Tuesday, 17 March 2015

Changing a hosts display name case in SCVMM

If you want to change the displayed case of hosts in SCVMM to upper case below this the SQL query you need to execute on the SCVMM SQL database.

Stop the System Center Virtual Machine Manager and System Center Virtual Machine Manager Agent service on the SCVMM server.

Open SQL Studio manager, select the VirtualManagerDB and take a backup first! Then paste this code into a new query window and select execute.

SELECT [ComputerName], UPPER(LEFT([ComputerName], CHARINDEX('.', [ComputerName], 1) -1)) +
            RIGHT([ComputerName], LEN([ComputerName]) - CHARINDEX('.', [ComputerName], 1) + 1)
FROM [VirtualManagerDB].[dbo].[tbl_ADHC_Host]

UPDATE [VirtualManagerDB].[dbo].[tbl_ADHC_Host]
SET [ComputerName] = UPPER(LEFT([ComputerName], CHARINDEX('.', [ComputerName], 1) -1)) +
                               RIGHT([ComputerName], LEN([ComputerName]) - CHARINDEX('.', [ComputerName], 1) + 1)

Start the System Center Virtual Machine Manager and System Center Virtual Machine Manager Agent service on the SCVMM server.

Job done!

Using PowerShell Enter-PSSession when your computer isn't on the domain.

Quite often when i'm at a customers site I need to work on their servers. Each time I go to site I don't join my laptop to the customers domain. The problem with this is that when you use the Enter-PSSession command you get an error message about the fact that your computer is not joined to the domain that the server is.

This also presumes you have enabled PSRemoing on the destination host with this command:

Enable-PSRemoting -Force

Here is the work around; Enter the first command on you computer once only. This tells your computer to trust the identify of any remote computers. This should not be done on non technical users computers as the security implications are obvious.

Set-Item WSMAN:\Localhost\Client\TrustedHosts -Value * -Force

The command below will connect you to the computer of your choice, you will need change the IP address or substitute a computer name, you will also need to change the domain and username to an account that is active on the server.

Enter-PSSession -ComputerName -Credential domain\username -Authentication negotiate

Wednesday, 11 March 2015

DHCP scope exhausted with BAD_ADDRESS enteries

I noticed a new VM would not get a DHCP address from one of the customers DC's, after remoting into the DC we could see that the scope was full. Upon further inspection the scope had been filled with BAD_ADDRESS entries. We selected all the BAD_ADDRESSES and deleted them, but within minutes it was full again.  I knew it had to be some of the new equipment we had plugged in, this was disconnected and I used the PoSh below to see if any new BAD_ADDRESS entries emerged.

Get-DhcpServerv4Lease -ScopeId "" | Where {$_.HostName -eq "BAD_ADDRESS"}

Isolated the problem to two new downstream Force 10 MXL switches that have DHCP enabled in the default VLAN. The commands below were issued on the switch to resolve the problem with the scope filling.

>interface VLAN 1
>no IP address DHCP
>do wr

The PoSh command above was used to make sure that no new BAD_ADDRESS entries existed.