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

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”

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.

Connecting with android Boxer mail app to hotmail account over ActiveSync

By default if you try to connect to any Hotmail e-mail with Boxer app (current version 2.0.0), which is a default in CyanogenOS 12s, it set up your account with IMAP and SMTP. Such setup prevents you from using your calendar and contacts. To fix this you should set up your connection with ActiveSync, but such option is not available by default. To set up it correctly you need to do following steps.

1. Set up your Hotmail account on your PC with Outlook. You need to do this to find server which holds your account. Correctly working e-mail agents can connect to m.outlook.com which re-targets it to correct server, but Boxer is not such software.

2. Open Outlook with previously set up account.

3. In notification area right-click on Outlook icon holding Ctrl button and choose Connection status…

4. Write down your Server name.

5. Set up Boxer for you_account@hotmail1.com or any other incorrect domain.

6. Choose Exchange

7. Press Cancel for auto detection

8. Correct your username and password

9. Fill in Server field with server name from step 4

10. When you press Next it will be set up.

That’s all

Cisco Any Connect with Windows 10 build 10061 Repairing vpn adapter

Today our network administrator applied latest patch to Cisco ASA. After that, any new connection with AnyConnect was starting update procedure, which failed every time even after reboot. I’ve uninstalled application and installed the newest version. After that any connection showed:

Repairing vpn adapter

Which have failed each time. To fix this I’ve changed settings for Ethernet adapter used by AnyConnect to obtain IP address automatically. After that AnyConnect reinstalled virtual adapter and connected without any issue. My colleague fixed this problem with deletion of:

%LOCALAPPDATA%\Cisco\

folder.

Find all VMWare VMs created in a given period

To find all virtual machines created in a given period use the following SQL script:

select ev.CREATE_TIME, EV.VM_NAME AS OldName
from VPX_EVENT EV
Where (EV.event_type = ‘vim.event.VmDeployedEvent’ OR EV.EVENT_TYPE = ‘vim.event.VmCreatedEvent’ OR EV.EVENT_TYPE = ‘vim.event.VMClonedEvent’) AND EV.CREATE_TIME >= cast(‘01.01.2013’ AS DATETIME) AND EV.CREATE_TIME <= cast(‘31.01.2014’ AS DATETIME)

Output of this script will show all created VMs including deleted ones. To show only existing virtual machines you can use following SQL script:

select EV.CREATE_TIME, EV.VM_NAME AS OldName, INF.NAME AS CurrName
from VPX_EVENT EV, VPX_VM_CONFIG_INFO INF
Where EV.VM_ID=INF.ID AND (EV.event_type = ‘vim.event.VmDeployedEvent’ OR EV.EVENT_TYPE = ‘vim.event.VmCreatedEvent’ OR EV.EVENT_TYPE = ‘vim.event.VMClonedEvent’) AND EV.CREATE_TIME >= cast(‘01.01.2013’ AS DATETIME)

As you can see it can help you to find renamed virtual machines as well. One of the biggest problem of this script is that it relies on events, which can be deleted by time when you run script. Unfortunately it is impossible to find the same data any other way. The only other solution is to use custom fields, which have to be created to the moment of need.

select ev.CREATE_TIME, EV.VM_NAME AS OldName
from VPX_EVENT EV
Where (EV.event_type = ‘vim.event.VmDeployedEvent’ OR EV.EVENT_TYPE = ‘vim.event.VmCreatedEvent’ OR EV.EVENT_TYPE = ‘vim.event.VMClonedEvent’) AND EV.CREATE_TIME >= cast(‘01.01.2013’ AS DATETIME) AND EV.CREATE_TIME <= cast(‘31.01.2014’ AS DATETIME)

Restoring MSSQL database to new location from command line with IBM TSM

Just a simple commands sequence with comments.

tdpsqlc.exe q tsm SOURCE_DB_NAME f /all

write down Database Object Name for needed full backup.

If you want to recover database backed up with options from dsm.opt file use following command:

tdpsqlc restore SOURCE_DB_NAME  full /into=DESTINATION_DB_NAME/RELocate=DATA_FILE_NAME,LOG_FILE_NAME /to=PATH_TO_DATA_FILE.mdf,PATH_TO_LOG_FILE.ldf /RECOVery=no /replace /object=DATABASEOBJECTNAME

If you want to recover database backed up with options different from dsm.opt, use following:

tdpsqlc restore SOURCE_DB_NAME full /into=DESTINATION_DB_NAME /RELocate=DATA_FILE_NAME,LOG_FILE_NAME /to=PATH_TO_DATA_FILE.mdf,PATH_TO_LOG_FILE.ldf /RECOVery=no /replace /object=DATABASEOBJECTNAME /tsmoptfile=other.opt

tdpsqlc.exe q tsm SOURCE_DB_NAME diff /all

Write down Database Object Name for needed diff backup

tdpsqlc restore SOURCE_DB_NAME diff /into=DESTINATION_DB_NAME /RELocate=DATA_FILE_NAME,LOG_FILE_NAME /to=PATH_TO_DATA_FILE.mdf,PATH_TO_LOG_FILE.ldf /RECOVery=no /replace /object=DATABASEOBJECTNAME

tdpsqlc.exe q tsm SOURCE_DB_NAME log=* /all

Write down Database Object Names for all needed log backups

tdpsqlc restore SOURCE_DB_NAME log=* /into=DESTINATION_DB_NAME /RELocate=DATA_FILE_NAME,LOG_FILE_NAME /to=PATH_TO_DATA_FILE.mdf,PATH_TO_LOG_FILE.ldf /RECOVery=no /object=DATABASEOBJECTNAME

…repeat for all needed logs

tdpsqlc restore SOURCE_DB_NAME log=* /into=DESTINATION_DB_NAME /RELocate=DATA_FILE_NAME,LOG_FILE_NAME /to=PATH_TO_DATA_FILE.mdf,PATH_TO_LOG_FILE.ldf /RECOVery=yes /object=DATABASEOBJECTNAME

Do not forget to add recovery=yes to last restored log.

Unexpected server reboot caused by windows update

Recently I’ve got unexpected Windows server 2008 R2 reboot with some recovery reason, which is quite uninformative:

The process C:\Windows\system32\svchost.exe (servername) has initiated the restart of computer servername on behalf of user NT AUTHORITY\SYSTEM for the following reason: Operating System: Recovery (Planned)
Reason Code: 0x80020002
Shutdown Type: restart
Comment:

As time of reboot was very close to 03:00 AM (default windows update installation time) and System event log contained couple of events about update installation, I’ve decided to check WindowsUpdate.log file.

It has following:

2013-12-16    03:17:06:606     832    13c8    AU    AU invoking RebootSystem (OnRebootNow)
2013-12-16    03:17:06:647     832    13c8    Misc    WARNING: SUS Client is rebooting system.
2013-12-16    03:17:06:647     832    13c8    AU    AU invoking RebootSystem (OnRebootRetry)
2013-12-16    03:17:06:651     832    13c8    AU    AU received handle event

So to eliminate such unexpected reboots disable automatic updates for production servers, or deny it automatically reboot server.