19 February 2014

NIC missing after migrating linux based Hyper-V VM

You might notice, that after moving VHD file to another location and recreating the virtual machine, you don’t have a valid NIC shown in ifconfig output:

image

The solution is to remove /etc/udev/rules.d/70-persistent-net.rules file. After reboot you will have the NIC back:

image


Edit in 2024-05-14

All you need basically is this:

rm /etc/udev/rules.d/70-persistent-net.rules

nano /etc/sysconfig/network-scripts/ifcfg-eth0


Make the file to contain only this:

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=dhcp


Save the file and after that reboot:

reboot


31 January 2014

“VMM cannot find VirtualHardDisk object” when refreshing a virtual machine in Virtual Machine Manager 2012

You might get an error when refreshing a virtual machine on VMM:

Error (801)
VMM cannot find VirtualHardDisk object 3ce58e1c-bfff-421d-8155-b06fb2fb4ea5.

Recommended Action
Ensure the library object is valid, and then try the operation again.

image

To resolve this, use the following SQL command against your VMM database:

delete from dbo.tbl_WLC_VDrive where VHDId='3ce58e1c-bfff-421d-8155-b06fb2fb4ea5'

image

The ID is the same in error message and in SQL command.

Of course you should have backup of your VMM database and stop VMM service before the command and start VMM service after the command.

Updated 19.04.2017:

Today I found out for one vm, that this command would work also if above doesnt help

delete from dbo.tbl_WLC_VDrive where Name='virtualservername'

but first try to find, whether you delete the right one or not by changing “delete” to “select *”

select * from dbo.tbl_WLC_VDrive where Name='life'

24 January 2014

DPM or VMM server gives Error 21201 about SMBIOSGUID when adding a hyper-v host

Edited on 18.04.2017: The same procedure verified to be working with VMM (Virtual Machine Manager) also. Googled my error message and found my own blog post, what a shame Smile

When adding a hyper-v host to Data Protection Manager Server, you might get the following error:

Error (21201)
Another machine with the same SMBIOSGUID is found.

Recommended Action
An SMBIOS GUID should uniquely identify the machine. Please provide the correct value or contact the machine manufacturer to help update the hardware with correct information.

The problem usually is with the same computer have been managed using the same dpm server, but not correctly removed from dpm.

Help comes with following SQL command:

SELECT a.PhysicalMachineId,b.ComputerName FROM tbl_PMM_PhysicalMachine a left join tbl_ADHC_Host b on a.PhysicalMachineId = b.PhysicalMachineId order by ComputerName

This command finds all computers, that are present in DPM server and shows physical machine ID and computer name. Try to find computers with name not present (NULL). If you have them, then delete those records from tbl_PMM_PhysicalMachine table. Use corresponding physicalmachineID for finding them.

Edit on 26.04.2017 --------------------------------------

The command to delete the NULL entries is:

delete from tbl_PMM_PhysicalMachine where PhysicalMachineId = (SELECT a.PhysicalMachineId FROM tbl_PMM_PhysicalMachine a left join tbl_ADHC_Host b on a.PhysicalMachineId = b.PhysicalMachineId where ComputerName is null)

Edit on 10.06.2022 --------------------------------------

Now let's find all computers SMBIOSGUID with that SQL clause:

SELECT
    h.ComputerName,
    p.SmBiosGuid,
    h.PhysicalMachineId
FROM
    tbl_ADHC_Host AS h,
    tbl_PMM_PhysicalMachine AS p
WHERE
    h.PhysicalMachineId = p.PhysicalMachineId
ORDER BY
    ComputerName

16 January 2014

Get rid of old computer accounts in Active Directory

If your Active Directory has been running for several years and you don’t cleanup old computer accounts, then you might run into Active Directoy Users and Computers (dsa.msc) warning:

image

When you really do have more than 2000 computers in your system, then you don’t need to do anything :) But having only tens or hundreds of computers, then you should clean up your AD, perhaps do it regularly.

Every active computer in domain changes it’s (computer account) password every 30 days. Very old Windows NT4 computers every 7 days. Every computer account in Active Directory has information, when the password was last changed (passwordlastset). Let’s assume, that some users go on vacation and don’t use the computer for a month or so. It means, that when you discover a computer account, with passwordlastset older than 60 days, it’s (almost) safe to delete it.

To get the list of computer accounts, that havent changed use this powershell command:

Get-ADComputer -Filter * -Properties passwordlastset | where {$_.passwordlastset -lt (get-date).adddays(-60)} | select Name,PasswordLastSet | ConvertTo-Csv  -Delimiter `t -NoTypeInformation | clip

image

After that you can paste the info into excel and take a look, what computers will be deleted, when you use the next command.

image

When the list is ok for deletion, then use this command:

Get-ADComputer -Filter * -Properties passwordlastset | where {$_.passwordlastset -lt (get-date).adddays(-60)} | Remove-ADObject –Recursive

You can also use -confirm switch to change behaviour of asking whether to delete. This is useful when using this command on scheduled task.

08 January 2014

How to configure Windows Time service in (virtualized) Active Directory environment

Default behavior in Active Directory environment uses your domain controller with PDC emulator role as the primary source for time information and all other domain member servers and workstations use this time as authoritative.
To get the information about FSMO (Flexible single master operation) roles, type:
netdom query fsmo
image
If some of your domain controllers are virtualized, then your clock will soon be left behind. This happens because hyper-v host is obtaining time from primary source (virtualized domain controller) and after the clock on hyper-v host is set, then the same time will be set also on virtualized domain controller itself, creating a loop. During this loop, clock will shift bit by bit and left behind (a minute per week or so).
To overcome this situation, you need to disable hyper-v clock synchronization on all virtual domain controllers:
image
After that you should correct the time on PDC role owned domain controller. You should do this by using external time source. I suggest following commands:
w32tm /config /syncfromflags:manual /manualpeerlist:"ntp.data.ee"
w32tm /config /update

You can replace ntp.data.ee with some other time server on internet. To force the update you could use this command:
w32tm /resync
To show the configuration use this command:
w32tm /query /configuration
To reset messed up w32tm configuration, use following commands:
net stop w32time
w32tm /unregister
w32tm /register
net start w32time

This nice powershell script shows you time information on all domain servers:
$servers = Get-ADComputer -LDAPFilter "(operatingsystem=*server*)"
$servers | foreach {$server=$_.name ; net time \\$server} | clip

First line gets information about AD computers and selects only computers with server operating system. Second line uses net time command to get information for each server and places the result in clipboard, so you can paste it to excel, notepad etc.
Edit 27.04.2016 -------------------------------------------
Today, reconfiguring the situation, I found out, that the easiest thing to do is to use those 2 commands in PDC role owner:
w32tm /config /manualpeerlist:"pool.ntp.org" /syncfromflags:manual /reliable:yes /update
w32tm /resync


Edit 04.12.2018 --------------------------------------------
To see, which domain controller has wrong time in your environment:
$servers = Get-ADDomainController -Filter *
$servers | foreach {$server=$_.name ; net time \\$server | findstr Current} 

13 December 2013

How to discover which WiFi AP is being used on Windows 7/8

When you have multiple access point and you want to see, how you are roaming between them and which one is currently in use, then you can monitor this using following procedure:

  1. Press Win+R, Run windows appears
    image
  2. Paste following text:
    powershell do {cls ; netsh wlan show int | findstr SSID ; netsh wlan show networks mode=Bssid | findstr SSID ; sleep 1} while (1)
  3. Press OK
    image

Then you can see which WiFi network you are using and which WiFi AP you are using (WiFi AP-s MAC address). Also you can see, which AP-s are visible.

image

In my case I have two network visible, both with 5 different AP-s. First two lines show What network I’m using (SSID) and which AP I am connected to (BSSID).

24 September 2013

Resolve DPM Agents Time Zone problems quickly

I reside at UTC+2 time zone and it is exactly 10 hours different from Windows Server post installation default time zone (UTC-8). So when I schedule a backup in Data Protection Manager from the server with default time zone, it happens 10 hours later. So about half of my protected servers ran the backup at 12:00 (about lunchtime) instead of 02:00 in the night as it should be. If I change the time zone in the server, it won’t help.

This is because at the installation of the DPM Agent the time zone was not changed yet. Microsoft has the solution, which is very painful. It consists of uninstallation and installation of the agent and recreating the protection group.

After digging in DPM Servers SQL database, I found a quick and a little bit dangerous way of resolving the issue. You need to connect with SQL Management Studio to your DPM database and look at the table tbl_AM_ServerTimeZone:

SELECT * FROM tbl_AM_ServerTimeZone

image

Copy one row with correct time zone to notepad and make a new command according the info you just pasted:

update tbl_AM_ServerTimeZone set
Bias = -120 ,
Description = '(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius' ,
DaylightName = 'FLE Daylight Time' ,
DaylightBias = -60 ,
DaylightYear = 0 ,
DaylightMonth = 3 ,
DaylightDayOfWeek = 0 ,
DaylightDay = 5 ,
DaylightHour = 3 ,
DaylightMinute = 0 ,
DaylightSecond = 0 ,
DaylightMillisecond = 0 ,
StandardName = 'FLE Standard Time' ,
StandardBias = 0 ,
StandardYear = 0 ,
StandardMonth = 10 ,
StandardDayOfWeek = 0 ,
StandardDay = 5 ,
StandardHour = 4 ,
StandardMinute = 0 ,
StandardSecond = 0 ,
StandardMillisecond = 0

This command updates time zone information on all agents! So please be careful.

After this single SQL command you must edit the badly behaving protection groups. You don’t need to change anything on those, but just click Next, Next, Finish.

image

EDIT 2024-10-14: This instruction still works with DPM 2022 and Microsoft has not fixed that issue so no other ways to easily fix this.