Category Archives: Windows

Get a list of all VM in a cluster, that dosen’t hve Limit CPU For migration set to true

Get a list of all VM in a cluster, that dosen’t hve Limit CPU For migration set to true:

Import-Module -Name "virtualmachinemanager"
Get-Vmmserver localhost
$hc = Get-VMHostCluster -Name CLUSTERNMAE
$hosts =get-vmhost -VMHostCluster $hc
foreach($h in $hosts) {
	get-vm -vmhost $h |Where { $_.LimitCPUForMigration –eq $FALSE } | select Name
}

 

Shring SQL log file

USE [TestDb]
GO
ALTER DATABASE [TestDb] SET RECOVERY SIMPLE WITH NO_WAIT
DBCC SHRINKFILE([TestDb_Log], 1)
ALTER DATABASE [TestDb] SET RECOVERY FULL WITH NO_WAIT
GO

 

Where TestDB, is the database name, and TestDB_Log is the SQL Log file name.

Windows 8 and Microsoft VPN problems

Today i have the problem where a Windows 8 machine, won’t connect to Microsoft VPN server.

The problems was that MSChapV2 was disabled on the client.
Please find this under Security and Allowed these protocols.

The error message I got from both the VPN servers and the client was:

Server:
The following error occurred in the Point to Point Protocol module on port: VPN2-9, UserName: XXXXX\XX. The connection was prevented because of a policy configured on your RAS/VPN server. Specifically, the authentication method used by the server to verify your username and password may not match the authentication method configured in your connection profile. Please contact the Administrator of the RAS server and notify them of this error.

Client:
Error 815: The connection was prevented because of a policy configured on your RAS/VPN server. Specifically, the authentication method used by the server to verify your username and password may not match the authentication method configured in your connection profile. Please contact the Administrator of the RAS server and notify them of this error.

Please see more here: http://jermsmit.com/windows-8-vpn-error-812/

Uninstall all updates installed on a specific day

Get the list of the update

wmic qfe get hotfixid,installedon | findstr MM/DD/YYYY > c:\list.txt

 

  1. Open C:\list.txt in Notepad.
  2. Go to Edit > Replace and set the following field values:
    Find what: KB
    Replace with: Leave the line empty
  3. Go to Edit > Replace and set the following field values:
    Find what: MM/DD/YYYY
    Replace with: Leave the line empty
  4. Generate this uninstall script:

for /f %i in (‘type c:\list.txt’) do echo wusa /uninstall /kb:%i >> c:\uninstall.list

Open uninstal.list  run each line by itselft.

 

 

Exchange: Get a list of all email address

For en liste over alle mail adresse

Get-recipient -resultsize unlimited | select name -expand emailaddresses | select name,smtpaddress

For en liste over alle mail adresse på et given domæne

Get-Recipient | Where{$_.EmailAddresses -match "it-grp.dk"} | select name -expand emailaddresses | select name,smtpaddress | where {$_ -match "kennethdalbjerg.dk"}

Dual boot Ubuntu and Windows 7, with Safeboot / Mcafee Endpoint Encryption

First you need to install Windows 7, and safeboot / Mcafee endpoint protection.

Then you need to take a backup of the MBR, this is done with a Ubuntu live cd, run this commands:

dd if=/dev/sda of=/path/safeboot.mbr bs=512 count=1

 

Put it on a USB flash drive or something else, that you can access after the installation.

After you have make a backup of the MBR, just install Ubuntu the normally way, after you have make changes to grub2 config files.

cp /path/safeboot.mbr /boot/
nano /etc/grub.d/40_custom

At the buttom of this files you need to insert this:

menuentry "Windows 7" {
set root='hd0,msdos1'
chainloader (hd0,msdos5)/boot/safeboot.mbr
boot
}

Where set root=’hd0,msdos1′ is becuase my windows 7 root partition is locate on disk 0, and msdos partition 1, and chainloader (hd0,msdos5)/boot/safeboot.mbr is because my ubuntu partition is located on disk 0 and msdos partition 5.

Citrix XenDesktop – Desktop Popsup with connection and then closes

Today i have this problem, that my brand new setup of XenDesktop just start and showing connecting, but just after a few seconds just drop the connection, and the VDI is restarting.

So I push the connect buttom and when it shows connecting, i put the machine in maintaince mode, so it is not restarting automatic.

Then look at the Event Viewer, and it was showing this error:
Source: Citrix ICA Service
Event ID: 1260
Type: Warning
Description: ICA connection is cancelled because auto-logon is enforced and auto-logon failed.
For more information, see
http://support.citrix.com/proddocs/topic/online-plugin-121-windows/ica-sson-enable.html.

When look at the support.citrix.com page I got a 404 error page.

Search the Internet and found at that my user account dosent was permitted to logon locally, enable this though Group Policy
Group Policy here: Computer Configuration -> Policies -> Windows Settings -> Security Settings -> Local Policies -> User Rights Assignment -> Allow log on locally

By default the following users and groups are granted to log on locally on windows 7:
Guest
Administrators
Users
Backup Operatiors