Wednesday, December 11, 2013

“Everything You Wanted to Know about SR-IOV in Hyper-V” by John Howard

Very good articles on SRIOV by John Howard.

-----------------------------------------------------------------------------------------------------
Part 1 discusses emulated versus software devices, the pros and cons and constraints of each and why Microsoft is investing in SR-IOV.
-----------------------------------------------------------------------------------------------------
Part 2 discusses the SR-IOV standard, physical functions (PFs) virtual functions (VFs) and the hardware requirements to make SR-IOV even possible.
-----------------------------------------------------------------------------------------------------
Part 3 discusses device drivers and how they function in an SR-IOV environment as well as screenshots of an SR-IOV NIC within a Hyper-V VM.
-----------------------------------------------------------------------------------------------------
Part 4 discusses some of the low level necessary firmware and motherboard changes to make SR-IOV function and provides a pointer to an interesting presentation given 4 years ago at WinHEC 2008 by Jake Oshins that provides further insight into SR-IOV.
-----------------------------------------------------------------------------------------------------
Part 5 explains the IO path with SR-IOV enabled, covers SR-IOV configuration via the UI and a deeper dive into PowerShell.
-----------------------------------------------------------------------------------------------------
Part 6 discusses SR-IOV and Live Migration in detail. It covers the engineering challenge of making SR-IOV work with Live Migration (not trivial folks) and even includes a video that demonstrates a virtual machine with an SR-IOV NIC under load being Live Migrated. There’s even a link to a WinHEC 2006 presentation (told you we’ve been looking at this technology a while…)
-----------------------------------------------------------------------------------------------------
Part 7 discusses SR-IOV and how it works with the new inbox Windows Server 2012 NIC Teaming. Yes folks, you can team SR-IOV NICs in the guest.
-----------------------------------------------------------------------------------------------------
Part 8 discusses debugging SR-IOV and includes examples in PowerShell and covers troubleshooting through the Event Viewer.

Friday, November 8, 2013

Want to crash the system manually?

You have seen BSOD on windows system many times. But may wonder how to crash it manually. Here is the tool that can help you do it.

http://download.sysinternals.com/files/NotMyFault.zip
Note: This is not my application. It is owned by sysinternals.com

Interview Questions 2

How to find the middle node from a link list?

middle = last = head;

while( last!=NULL && last->next != NULL )
{
middle = middle->next;
last = last->next->next;
}

// here middle element is in the middle of list


How to count the number of on bits in the number?

count=0;
while( n>0 )
{
if( n & 1 )
{
count++;
}
n = n>>1;
}


How can you delete a node from a singly link list?
you are provided with only the pointer to node.


Save next node.
Copy all the data from the next node to the current node.
copy the next pointer from next node to the current node.
then delete the next node.

temp = node->next;
node->data = node->next->data;
node->next = node->next->next;
delte temp;

This would not work if the provided node is last element.

Monday, October 21, 2013

Windows Server core 2008 R2 Commands

Hostname, domain membership:
Rename computer
netdom renamecomputer %computername% /newname:MyNewHostname
Join machine to domain
netdom join %computername% /domain:corp.mycompany.com/userd:CORP\jsmith /passwordd:*
Rename computer while joined to domain
netdom renamecomputer %computername% /newname:MyNewHostname/userd:CORP\jsmith /passwordd:*
Remove machine from domain
netdom remove %computername%
Interfaces and addresses:
View the current interface list
netsh interface show interface
Set static IP, mask, gateway
netsh interface ipv4 set address ”Local Area Connection”source=static 10.3.1.11 255.255.255.0 10.3.1.1
Set primary DNS server
netsh interface ipv4 add dnsserver ”Local Area Connection”address=10.3.1.21 index=1
Set secondary DNS server
netsh interface ipv4 add dnsserver ”Local Area Connection”address=10.3.1.22 index=2
Remove DNS server from interface
netsh interface ipv4 delete dnsservers ”Local Area Connection”10.3.1.21 (or all)
Set interface to DHCP
netsh interface ipv4 set address ”Local Area Connection”source=dhcp
Disable interface
netsh interface set interface “Local Area Connection” disabled (orenabled to re-enable)


Drivers and services:
Query active drivers
sc query type= driver
Install a driver
pnputil -i -a oemdriver.inf
List running services
sc query
Start / stop a service
sc start (service name) sc stop (service name)
Disable a service
sc config (service name) start= disabled


Windows Firewall, remote management:
Allow server to be managed by Remote Desktop
cscript C:\Windows\System32\SCregEdit.wsf /ar 0
Verify registry entry for above
cscript C:\Windows\System32\SCregEdit.wsf /ar v
Allow Remote Desktop sessions from older RDP clients (lower security setting)
cscript C:\Windows\System32\SCregEdit.wsf /cs 0
Verify registry entry for above
cscript C:\Windows\System32\Scregedit.wsf /cs v
Windows Firewall: allow ICMPv4 echo-request inbound
netsh advfirewall firewall add rule name=”ICMP Allow incoming V4 echo request” protocol=icmpv4:8,any dir=in action=allow
Windows Firewall: allow Remote Desktop
netsh advfirewall firewall set rule group=”Remote Desktop” new enable=yes
Windows Firewall: allow remote management of Windows Firewall
netsh advfirewall firewall set rule group=”Windows Firewall Remote Management” new enable=yes
Windows Firewall: allow remote management of OS via MMC snap-ins
netsh advfirewall firewall set rule group=”Remote Administration” new enable=yes
Enable Windows Remote Shell
WinRM quickconfig


Power management:
List existing Power Schemes
powercfg -l
Turn hibernation off
powercfg -hibernate OFF
Set absentia power scheme (used when no one is logged in)
powercfg -setabsentia 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
Set Power Configuration for High Performance
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c


Other:
Install OS product key
slmgr.vbs -ipk 1234-5678-90ab-cdef-ghij
Activate OS installation
slmgr.vbs -ato
List processes
tasklist
Kill process by process ID
taskkill /PID 3852
Invoke Task Manager
taskmgr
List log names
wevtutil el
Export log to file
wevtutil epl c:\mylog1.txt
Query log for events
wevtutil qe /f:text System
Clear log
wevtutil cl System
Adjust paging file
wmic pagefileset where name=”d:\pagefile.sys” set InitialSize=1024,MaximumSize=2048
Set proxy setting
netsh winhttp set proxymyproxy.corp.mycompany.com:8080
Add domain account to local Administrators group
net localgroup Administrators /add CORP\jsmith
Delete domain account from local Administrators group
net localgroup Administrators /delete CORP\jsmith
Reboot the machine immediately
shutdown /r /f /t 0
Log off current interactive session
logoff


View installed roles: Dism /online /get-features /format:table
Active Directory Certificate Services
Dism /online /enable-feature /featurename:CertificateServicesUninstall: Dism /online /disable-feature /featurename:CertificateServices
Active Directory Lightweight Directory Services
Dism /online /enable-feature /featurename:DirectoryServices-ADAM-ServerCore Uninstall: Dism /online /disable-feature /featurename:DirectoryServices-ADAM-ServerCore
Active Directory Domain Services
dcpromo /unattend:myunattend.txt  Demote: dcpromo
DNS Server
Dism /online /enable-feature /featurename:DNS-Server-Core-RoleManage: dnscmd Uninstall: Dism /online /disable-feature /featurename:DNS-Server-Core-Role
DHCP Server
Dism /online /enable-feature /featurename:DHCPServerCore Manage: netsh sc config dhcpserver start= auto net start dhcpserver Uninstall: Dism /online /disable-feature /featurename:DHCPServerCore
File Services
Dism /online /enable-feature /featurename:FRS-infrastructure Dism /online /enable-feature /featurename:DFSN-Server Dism /online /enable-feature /featurename:DFSN-Server Dism /online /enable-feature /featurename:ServerForNFS-Base Dism /online /enable-feature /featurename:ClientForNFS-Base Uninstall: Dism /online /disable-feature /featurename:(specify role name)
Hyper-V
Dism /online /enable-feature /featurename:Microsoft-Hyper-V
Print Services
Dism /online /enable-feature /featurename:Printing-ServerCore-Role 32-bit support: Dism /online /enable-feature /featurename:Printing-ServerCore-Role-WOW64 Dism /online /enable-feature /featurename:Printing-LPDPrint-Service (manage by using Print Management console from another machine)


View installed features: Dism /online /get-features /format:table
BranchCache
Dism /online /enable-feature /featurename:PeerDistDism /online /enable-feature /featurename:PeerDistHashPDism /online /enable-feature /featurename:SMBHashGeneration
IIS Management Service
Dism /online /enable-feature /featurename:IIS-ManagementServiceEnable remote management:HKLM\Software\Microsoft\WebManagement\Server - changeEnableRemoteManagement to 1; net start wmsvc
Input Method Editor 32-bit support
Dism /online /enable-feature /featurename:ServerCore-EA-IME-WOW64
.NET Framework 2.0
Dism /online /enable-feature /featurename:NetFx2-ServerCore 32-bit support: Dism /online /enable-feature /featurename:NetFx2-ServerCore-WOW64
.NET Framework 3.0 and 3.5
Dism /online /enable-feature /featurename:NetFx3-ServerCore 32-bit support: Dism /online /enable-feature /featurename:NetFx2-ServerCore-WOW64 32-bit support: Dism /online /enable-feature /featurename:NetFx3-ServerCore-WOW64
QWAVE
Dism /online /enable-feature /featurename:QWAVE
Removable Storage
Dism /online /enable-feature /featurename:Microsoft-Windows-RemovableStorageManagementCore
Simple Network Management Protocol (SNMP)
Dism /online /enable-feature /featurename:SNMP-SC
Subsystem for UNIX-based applications
Dism /online /enable-feature /featurename:SUACore 32-bit support: Dism /online /enable-feature /featurename:SUACore-WOW64
Telnet client
Dism /online /enable-feature /featurename:TelnetClient
Windows Internet Name Service (WINS)
Dism /online /enable-feature /featurename:WINS-SC
Windows PowerShell
Dism /online /enable-feature /featurename:MicrosoftWindowsPowerShell32-bit support: Dism /online/enable-feature /featurename:MicrosoftWindowsPowerShell-WOW64
Windows PowerShell Best Practices Analyzer cmdlets
Dism /online /enable-feature /featurename:BestPractices-PSH-Cmdlets
Windows PowerShell Server Manager cmdlets
Dism /online /enable-feature /featurename:ServerManager-PSH-Cmdlets
Windows Server Backup
Dism /online /enable-feature /featurename:WindowsServerBackup
Windows Server Backup Windows PowerShell cmdlets
Dism /online /enable-feature /featurename:WindowsServerBackupCommandlet
Windows Server Migration Tools
Dism /online /enable-feature /featurename:ServerMigration
WoW64
Dism /online /enable-feature /featurename:ServerCore-WOW64(installed by default)


The following may require additional hardware:
BitLocker Drive Encryption
Dism /online /enable-feature /featurename:BitLocker Remote administration tool: Dism /online /enable-feature /featurename: BitLocker-RemoteAdminTool
Failover Clustering
Dism /online /enable-feature /featurename:FailoverCluster-Core (not supported in Standard Edition)
Multipath IO
Dism /online /enable-feature /featurename:MultipathIo
Network Load Balancing
Dism /online /enable-feature /featurename:NetworkLoadBalancingHeadlessServer

Uninstall: Dism /online /disable-feature /featurename:(specify feature name)