P2V using SCVMM error’s because of disk space requirement

While performing a P2V with SCVMM 2012 I got the following error message:

There is not enough disk space on the available volumes.
Maximum disk space on the most appropriate volume, accounting for the host resource utilization  (in megabytes): 103450
The virtual machine requirement (in megabytes): 744776
The maximum available space at the time of evaluation, after considering the virtual machine requirements (in megabytes): 103450
ID: 3501 Continue reading P2V using SCVMM error’s because of disk space requirement

Windows Server 2012 Failover Cluster Virtual Fibre Channel Adapter Live Migration Error

I’ve got a multiple  node cluster running Windows Server 2012 with Brocade 415/815 4G/8G FC HBA’s connecting to a VX SAN. I am trying to get the virtual HBA’s working in Hyper-V Guest running Windows 2008 R2 (SQL Cluster). I first created 2 virtual SAN Switches one connected to each port on my physical HBA (each physical port connects to a separate fabric). I add two Virtual HBA’s in my Guest, one to each VSAN Switch. When I go to Zone the HBA’s I only see side A of the virtual HBA’s not both A and B. On each fabric I should see two (A and B) WWPN but I only see one, to solve this you must shut down the Guest OS and twist the address set name (copy Set Address A to  Set Address B  and Set Address B to Set address A) I can add disk and everything works, however when I go to Live migrate I get the following error due to side B not being zoned. Live migration of ‘Virtual Machine Win2012_01’ failed.

Virtual machine migration operation for ‘Win2012_01’ failed at migration destination ‘hv-cl07-c2’. (Virtual machine ID 2CE90D02-083C-4012-ACA1-BE8D35EFCA33)

‘Win2012_01’ Synthetic FibreChannel Port: Failed to finish reserving resources with Error ‘Unspecified error’ (0x80004005). (Virtual machine ID 2CE90D02-083C-4012-ACA1-BE8D35EFCA33)

‘Win2012_01’ Synthetic FibreChannel Port: Failed to finish reserving resources with Error ‘Unspecified error’ (0x80004005). (Virtual machine ID 2CE90D02-083C-4012-ACA1-BE8D35EFCA33)

To solve this problem, I have done the following:

  • Updated my drivers to the latest version (3.0.2.21)
  • Remember that the Virtual SAN path must be the same, for example when you create 2 paths then the VSAN A should always connect to FiberSwitch 1 and VSAN B should connect 2 Fberswitch 2. This is because when you try to live migrate the guest OS and the VSAN paths are different the fiberSwitch cannot build the connection.
  • My problem was however that I only had created one host on the SAN and configured all the 8 paths under one host, to resolve my problem I created one host for the address set A and one host for the address set B. So I have always one connected and one disconnected host on my SAN and when I am doing a Live migration then the both hosts are online

I hope that this will solve your problem to.

Best Regards,

Pouyan

 

Create FTP user (Powershell GUI)

Here is a small PowerShell script that I have written today, this is a GUI interface script that will help you create a FTP user with folder and will configure the permissions fore IIS:

[System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”)

##########################################################
##							##
##		--	SIGNATURE --			##
##							##
$Company =	'PKM-Technology'			##
$PoweredBye =	'Pouyan Khabazi'			##
$Date =		'30-05-2013'				##
$Version =	'V1'					##
##							##
##							##
##########################################################
[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Drawing')

$FieldBackGround = [System.Drawing.Color]::'Transparent'
$objForm = New-Object System.Windows.Forms.Form
	$objForm.Text = $Company + ' Create FTP User ' + $Version + ' | (' + $PoweredBye + ')'
	$objForm.Size = New-Object System.Drawing.Size(400,400)
	$objForm.MinimizeBox = $false
	$objForm.MaximizeBox = $false
	$objForm.ControlBox = $false
	$objForm.StartPosition = 'CenterScreen'
	$objForm.FormBorderStyle = 'FixedDialog'
	$objForm.KeyPreview = $True
	$objForm.AllowTransparency = $true
##Styling
$Font = New-Object System.Drawing.Font('Times New Roman','9')

$LabelUserName = New-Object System.Windows.Forms.Label
	$LabelUserName.Location = New-Object System.Drawing.Size(20,150) 
	$LabelUserName.Size = New-Object System.Drawing.Size(80,20)
	$LabelUserName.BackColor = $FieldBackGround
	$LabelUserName.Text = 'User name: '
	$objForm.Controls.Add($LabelUserName)
$TextboxUserName = New-Object System.Windows.Forms.TextBox
	$TextboxUserName.Location = New-Object System.Drawing.Size(100,150) 
	$TextboxUserName.Size = New-Object System.Drawing.Size(200,25)
	$TextboxUserName.Text = ''
	$objForm.Controls.Add($TextboxUserName)

$LabelFullName = New-Object System.Windows.Forms.Label
	$LabelFullName.Location = New-Object System.Drawing.Size(20,180) 
	$LabelFullName.Size = New-Object System.Drawing.Size(80,20)
	$LabelFullName.BackColor = $FieldBackGround
	$LabelFullName.Text = 'Full name: '
	$objForm.Controls.Add($LabelFullName)
$TextboxFullName = New-Object System.Windows.Forms.TextBox
	$TextboxFullName.Location = New-Object System.Drawing.Size(100,180) 
	$TextboxFullName.Size = New-Object System.Drawing.Size(200,25)
	$TextboxFullName.Text = ''
	$objForm.Controls.Add($TextboxFullName)

$LabelPassword = New-Object System.Windows.Forms.Label
	$LabelPassword.Location = New-Object System.Drawing.Size(20,210) 
	$LabelPassword.Size = New-Object System.Drawing.Size(80,20)
	$LabelPassword.BackColor = $FieldBackGround
	$LabelPassword.Text = 'Password: '
	$objForm.Controls.Add($LabelPassword)
$TextboxPassword = New-Object System.Windows.Forms.TextBox
	$TextboxPassword.Location = New-Object System.Drawing.Size(100,210) 
	$TextboxPassword.Size = New-Object System.Drawing.Size(200,25)
	$TextboxPassword.Text = ''
    $TextboxPassword.PasswordChar = '*'
	$objForm.Controls.Add($TextboxPassword)

$ButtonCreate = New-Object Windows.Forms.Button
	$ButtonCreate.Location = New-Object System.Drawing.Size(100,320) 
	$ButtonCreate.Size = New-Object System.Drawing.Size(100,25) 
	$ButtonCreate.text = 'Create user'
	$ButtonCreate.add_click({
        $userName = $TextboxUserName.Text
        $fullName = $TextboxFullName.Text
        $password = $TextboxPassword.Text
        $ftpFolder = "C:inetpubftproot" + $userName

        $Computer = [ADSI]"WinNT://$Env:COMPUTERNAME,Computer"
        #Local user if user exict
        $x = $Computer.psbase.Children | Where-Object {$_.psbase.schemaclassname -eq "user"} | select Name
         foreach ($user in $x) {
          if ($user.Name -eq $userName){
            #Write-Host User $user.name already exists
            $d = [Windows.Forms.MessageBox]::Show('User ' + $userName + ' already exists, please select another username!', [Windows.Forms.MessageBoxButtons]::OK)
            Return
          }
        }
        # Local user account creation:
        $TestUser = $Computer.Create("User", $userName)
        $TestUser.SetPassword($password)
        $TestUser.SetInfo()
        $TestUser.FullName = $fullName
        $TestUser.SetInfo()
        $TestUser.UserFlags = 64 + 65536 # ADS_UF_PASSWD_CANT_CHANGE + ADS_UF_DONT_EXPIRE_PASSWD
        $TestUser.SetInfo()
        # Add user to local group
        $group = [ADSI]"WinNT://./FTP_USERS,group"
        $group.Add("WinNT://$userName,user")
        # Create the FTP folder
        New-Item -ItemType directory -Path $ftpFolder -Force
        # Set permission on the folder
        $inherit = [system.security.accesscontrol.InheritanceFlags]"ContainerInherit, ObjectInherit"
        $propagation = [system.security.accesscontrol.PropagationFlags]"None"
        $acl = Get-Acl $ftpFolder
        $accessrule = New-Object system.security.AccessControl.FileSystemAccessRule($userName, "Modify", $inherit, $propagation, "Allow")
        $acl.AddAccessRule($accessrule)
        Set-Acl -AclObject $acl $ftpFolder

        $d = [Windows.Forms.MessageBox]::Show('User '+ $userName +' is created successfully! 
Do you want to close application?', 'Exit', [Windows.Forms.MessageBoxButtons]::YesNo)
		if ($d -eq [Windows.Forms.DialogResult]::Yes){
			$objForm.Close()
		} else {}
    })
    $objForm.controls.add($ButtonCreate)

##CLOSE BUTTON
$CancelButton = New-Object System.Windows.Forms.Button
	$CancelButton.Location = New-Object System.Drawing.Size(220,320)
	$CancelButton.Size = New-Object System.Drawing.Size(75,25)
	$CancelButton.Text = 'Close'
	$CancelButton.Add_Click({
		$d = [Windows.Forms.MessageBox]::Show('Are you shore you want to close the application?', 'Exit', [Windows.Forms.MessageBoxButtons]::YesNo)
		if ($d -eq [Windows.Forms.DialogResult]::Yes){
			$objForm.Close()
		} else {}	
	})
	$objForm.Controls.Add($CancelButton)

$objForm.Add_Shown({$objForm.Activate()})
[void] $objForm.ShowDialog()

Well you can use the script to start the GUI both you can also convert this to a EXE file, to convert the script to a EXE you can  download PS2EXE

Now you can run the coede below to confert the PS1 file to a EXE file

  • Start powershell in version 2 (if you are running version 3)
    powershell.exe -version 2
  • Browse to the folder where you unzipt the PS2EXE and run the code
    cd c:PS2EXE
    ps2exe.ps1 -inputFile C:ScriptsFTPuser.PS1 -outputFile C:ScriptsFTPuser.exe -noConsole

~pouyan

PowerShell – WmiObject and a corrupt repository

If repository is found to be inconsistent, for Vista and newer, run from elevated command prompt:

Winmgmt /salvagerepository

Note this command will take the content of the inconsistent repository and merge it into the rebuilt repository if it is readable

If the above doesn’t work, then run:

Winmgmt /resetrepository

Note this will reset repository to the initial state when the OS was first installed

~pouyan

Using PowerShell as the Shell on Windows Server Core

With PowerShell becoming one of the most important tools in a Windows administrator’s tool bag as well as really becoming the best prompt to use on Windows Server Core, I thought it was about time I documented how to change the command prompt that opens when you log into Server Core with a PowerShell prompt.

To complete this requires two steps:

  1. Enable/Install PowerShell on the Windows 2008 R2 Server Core computer
  2. Update the HKLMSoftwareMicrosoftWindows NTCurrentVersionWinLogonShell registry key replacing cmd.exe with PowerShell.exe

To enable PowerShell run SCONFIG from the command prompt and then select menu options 4 then 2. This will require the computer to be rebooted

Once rebooted login and in the CMD prompt type PowerShell. At the PowerShell prompt type:

SET-ITEMPROPERTY "HKLM: SOFTWAREMICROSOFTWINDOWS NTCURRENTVERSIONWINLOGON" SHELL POWERSHELL.EXE

Having completed above log off and back on and a powershell prompt will open instead.

~Pouyan