Association between virtual ethernet and virtual switch

You’ve just created couple of internal network switches in your Hyper-V Manager. Or you’ve just installed Docker for Windows and played with it a little. Now want to create NAT to allow your fresh new containers and/or virtual machines to have access to the Internet. Unfortunately there is no simple way to say which of the HNS Internal NIC adapters associated with proper vSwitch.

I’ve created simple script to show associations between virtual Ethernet interface and vSwitch. Here it is:

 

Script for Windows storage audit

I’ve created PowerShell script to collect all important information about windows physical disks, partitions and volumes (logical disks) and its connections. To use it you should have administrator right on target computer, otherwise only simple information about logical disks will be collected. This limitation is due to MSFT_PartitionToVolume WMI class, which is accessible only by local administrators.
Audit script

Windows storage hierarchy explained

Quick cheat sheet:
1) Physical disk, represented by Win32_DiskDrive and MSFT_Disk WMI classes. This is hardware presented to your computer. It is HDD, SSD, FC LUN or iSCSI LUN.
2) Partition, represented by Win32_DiskPartition and MSFT_Partition WMI classes. Partitions are walls that transforming your physical space into rooms, which later can be used to store your data. Physical disk can have 0 or more partitions.
3) Volume, represented by Win32_Volume and MSFT_Volume WMI classes. Volumes are named spaces, from abstract rooms you get living room, kitchen and bedrooms. You format room to make it “named room”. Or in other words, you format partition to some file system, i.e. NTFS, FAT or ReFS. Volumes can store data and provide access to it. One partition can have 0 or 1 volume. When partition has 0 volume, in most cases this means that there is no data accessible by user.
4) Logical Disks, represented by Win32_LogicalDisk. Logical disks are like doors to your named rooms. Without doors you can access your named rooms through windows (mount points) and ventilation (“start \\?\Volume{GUID}\” command), and of course it is not always convenient. So giving your volumes disk letter makes it Logical Disks. One volume equal to 0 or 1 logical disks.

“The update is not applicable to your computer”

Recently I’ve needed to apply 2 patches to our Windows 2008 R2. But both patches show me error “The update is not applicable to your computer”. But I knew for sure, that these updates were applicable, because installed file’s version was lower than the one contained in hotfixes.
In Setup log I’ve got “Windows update could not be installed because of error 2149842967” error.

The problem was that someone disabled Windows Modules Installer service on this machine, which is TrustedInstaller.exe process. After enabling and running this service, I’ve installed both patches successfully.

Install RemixOS on Hyper-V virtual machine

Sometimes you just need quickly deploy Android x86 server in your production environment using Microsoft Hyper-V virtualization. Now you can do it with Remix OS.

Installation to Hyper-V virtual machine is a bit tricky, but possible.

First of all create Generation 1 VM with at least 6 Gb HDD. I’ve tested VM with 2 Gb of RAM.

After creation of VM do not power on it.

Connect created VHD disk to any windows machine (Disk Management -> Right Click -> Attach VHD)

Initialize it as MBR disk.

Format it in FAT32 file system.

Detach VHD.

Continue reading “Install RemixOS on Hyper-V virtual machine”

Unattended install for Microsoft Dynamics CRM 2015 Outlook Add-In

To make fully unattended install package you need to do following steps:

1. Download install package: http://www.microsoft.com/en-us/download/details.aspx?id=45015

2.Extract package content:
CRM2015-Client-ENU-i386.exe /extract:c:\CRM_TEMP\1\2
Do not remove sub folders 1 and 2 from the path, because we need it later

3. Create Redist folder in c:\CRM_TEMP. Do not put it in the sub folders:

4. Create following sub folders in Redist folder:

cd c:\CRM_TEMP\Redist
mkdir dotNETFX
mkdir ReportViewer
mkdir SQLCE
mkdir SQLNativeClient
mkdir SQLSystemCLRTypes
mkdir VCRedist
mkdir VCRedist10
mkdir WindowsIdentityFoundation

Continue reading “Unattended install for Microsoft Dynamics CRM 2015 Outlook Add-In”

Limit group policy only to client OS

Sometimes you want to apply your policy to every client PC in many OUs. To do such you can use WMI filter. This is especially useful in messy AD structures, where is no dedicated OU for client computer objects.

Namespace: root\CIMv2
Query: select * from Win32_OperatingSystem where ProductType="1"

I use here following WMI Class and property:
https://msdn.microsoft.com/en-us/library/aa394239(v=vs.85).aspx#properties

ProductType
Data type: uint32
Access type: Read-only
Additional system information.
Work Station (1)
Domain Controller (2)
Server (3)

Can’t access any Outlook tabs on ribbon except Enterprise Vault

Recently one of our customers installed Microsoft Dynamics CRM Outlook add-in and discovered that after this action Microsoft Outlook became absolutely useless, because after start of the program there are no other tabs except Enterprise Vault, which is also used by this customer. Little research showed that the root of the problem is in some components of earlier version of Microsoft Office. To fix problem you need to delete following registry key:

HKEY_CLASSES_ROOT\TypeLib\{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}\2.4

To automate this across organization you can use group policy preferences:

Computer Configuration -> Preferences -> Windows settings ->Registry -> New -> Registry Item:

Action: Delete
Hive: HKEY_CLASSES_ROOT
Key Path: TypeLib\{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}\2.4

Random data big file creation

Sometimes you just need a big file. For example to test network speed, of backup speed. And to prevent software of hardware compression you need this file to be absolutely random. Also you do not want to write this file byte by byte, as it can be really slow. Here is my version of powershell script to generate such file:

$chunksize=2*1024*1024 #I use 2 Mb chunks
$filesize = 50*1024*1024*1024 # File size in bytes
[Byte[]]$randombuffer=@(0)*$chunksize #First of all we create buffer filled with zeroes
$Random = New-Object System.Random #Our random number generator
$myfile = New-Object IO.FileStream "c:\testfile", 'Append' #Replace c:\testfile with the proper path
1..($filesize/$chunksize) | %{$Random.NextBytes($randombuffer);$myfile.Write($randombuffer,0,$randombuffer.Length)};$myfile.Close() #Magic

TMG 2010 and “RPC Server unavailable”

Recently I have encountered strange TMG behavior. I have permitted all RPC connections to Domain Controllers with system rule and disabled RPC Filter plus switched off “Enable strict RPC compliance” option. But my WMI requests and any other RPC traffic from TMG servers to internal resources was still blocked. The error was “RPC Server Unavailable”. Some programs gave me error code 1722. The problem was in understanding of traffic direction for access rules containing “Local host”. To tell you the truth I still do not understand why it works such way. Even after I’ve read http://tmgblog.richardhicks.com/2011/12/05/forefront-tmg-2010-protocol-direction-explained/. So the short answer to fix this problem – you need to create new rule allowing RPC traffic with SOURCE=Internal and DESTINATION=Local host. Also after creation you need to disable RPC filtering for created rule.