Loads of new USB flash drives come "prepared" with all manner of stuff on it. If like me, you often just want to use the USB drive as OS build device you need to have it in a "native state" before you can use the Windows 7 USB/DVD download tool
http://images2.store.microsoft.com/prod/clustera/framework/w7udt/1.0/en-us/Windows7-USB-DVD-tool.exe
You will know that your USB drives needs to be when you receive the following error message
"We were unable to copy your files. Please check your USB device and the selected ISO file and try again."
DiskPart
You can resolve the issue using diskpart with the following list of commands
diskpart
list disk
select disk 1
clean
create partition primary
select partition 1
active
format quick fs=fat32
assign
exit
This assumed that the USB drive was identified as disk 1
PowerShell
Alternatively you can also use PowerShell in Windows 8 or Server 2012
Get-Disk
Initialize-Disk -Number 1 -PartitionStyle MBR
Clear-Disk -Number 1 -RemoveData -RemoveOEM
New-Partition -DiskNumber 1 -UseMaximumSize -IsActive -MbrType FAT32
Get-Partition -DiskNumber 1
Get-Volume
Format-Volume -DriveLetter f -FileSystem FAT32
This assumed that the USB drive was identified as disk 1 and that the partition was assigned drive letter f
30 April 2013
24 April 2013
Windows HotFix management with PowerShell
Labels:
PowerShell,
Scripts,
Windows 8,
Windows General,
windows server 2012
Checking if a particular hotfix / update / patch is installed is often an important post-build check. With non GUI Windows server deployments you can use the following command lines to get the info you want.Install from the command line
You can individually download and install windows updates by KB number. Simply go to download.microsoft.com and search for the KB number. Once downloaded you can use the Windows Update Standaline Installer to install the update.
wusa .\Windows8-RT-KB2822241-x64.msu /quiet
Retrieving list of installed updates
To get a full list of installed hotfixes run
get-hotfix
Get info on specific KB
Get-HotFix -id KB2803676
If you are looking for a specific few updates you can use a variable
$numbers = "KB2770917","KB2779768"
Get-HotFix -id $numbers
If you want to check for updates installed after a specified date
Get-HotFix | ? installedon -gt 2013/04/01
*Thank to Windows Scripting guy
Alternative commands
There are of course a few other toold that can give you a list of hotfixes but they
You can query the WMI with wmic
wmic qfe list
Our you can run good old systeminfo
systeminfo
22 April 2013
Determine Windows system up-time
Labels:
Scripts,
Windows General
Knowing how long a Windows server or even desktop has been up for can be very useful. These command lines will help you find the relevant info you are after.
net stats srv | find "since"
or
systeminfo | find "System Boot Time"
Both will return the system boot or running time and from there you can just work out the up-time. Easiest is just to put the boot date and the current date into Excel subtract the one form the other and it will give you the amount of days.
net stats srv | find "since"
or
systeminfo | find "System Boot Time"
Both will return the system boot or running time and from there you can just work out the up-time. Easiest is just to put the boot date and the current date into Excel subtract the one form the other and it will give you the amount of days.
18 April 2013
Manipulating vhd and vhdx with powershell
Labels:
Hyper-V,
PowerShell,
windows server 2012
Everything you want to know about how to create,convert, re-size, mount and attach Hyper-V disks.The Hyper-V management gui provides great simple to use tools for basic virtual disk manipulation, if however you want to get serious you break out the powershell cmdlets.
Creating a virtual disk
To start things off I will creat a new dynamic disk that is 25GB in size.
New-VHD -Path 'b:\test.vhdx' -Dynamic -SizeBytes 25GB
To check the properties of the disk as we progress we will keep referring to
Get-VHD .\test.vhdx
After the initial creation we will see
ComputerName : ET-LAB-HV03
Path : B:\test.vhdx
VhdFormat : VHDX
VhdType : Dynamic
FileSize : 4194304
Size : 26843545600
MinimumSize :
LogicalSectorSize : 512
PhysicalSectorSize : 4096
BlockSize : 33554432
ParentPath :
FragmentationPercentage : 0
Alignment : 1
Attached : False
DiskNumber :
IsDeleted : False
Number :
Converting between vhd and vhdx
The only thing you need to specify is the extention, the correct type is used.
Convert-VHD .\test.vhdx -DestinationPath .\testFixed.vhd
Converting between dynamic and Fixed
This is controlled by the -VHDType parameter
Convert-VHD .\test.vhdx -VHDType Fixed -DestinationPath .\testFixed.vhdx
Attaching a VHD to a virtual machine
Add-VMHardDiskDrive -VMName TestVM -Path B:\test.vhdx
Mounting a virtual disk to a physical host
Server 2012 introduced to feature of being able to mount a vhd as a disk form the OS.
mount-vhd .\test.vhdx
The disk will now appear as a disk to the operating system. Since created the disk but no partitions there is no associated volume.
Initialize the disk
Initialize-Disk -Number 1
Create the partition
New-Partition -DiskNumber 1 -DriveLetter j -Size 10GB
Create the volume
Format-Volume -DriveLetter j -FileSystem ReFS
Now that we have a volume on the disk we have a new attribute. if your run get-vhd now you will see a value for minimumsize
Un-mount the virtual disk
Dismount-VHD -DiskNumber 1
Re-size the fixed disk to a certain size
The vhd can only be as small as the minimumsize (Volume size) but it can be bigger
To shrink or grow the file to a predefined size use
Resize-VHD .\testfixed.vhdx -SizeBytes 15GB
Or to make it is small as possible use
Resize-VHD .\testfixed.vhdx -ToMinimumSize
Conclusion
Using powershell allows you to create and manage virtual disks at all it's life stages. It also provides more functionality that you have using the GUI tools and allows you to break away from predefined default size restrictions.
15 April 2013
F5 Diaries - Episode 4 - Really Simple Inbound Load Balancing with GTM
Labels:
F5,
F5 Diaries,
GTM,
LTM
Outbound load balancing is simply a case of putting a few internet lines together and sending traffic out and let it route back they same way. Inbound load balancing is a bit harder.
How it works
I am using the same lab form Episodes 1,2 and 3. From this we know that we have two Internet connections. If we want to be able to publish a web site on either connection it would need an IP address associated with each link.
The same site would therefore be available on two different IP addresses. This is where GTM comes in. It selects the IP address to return to the requester and this governs over which connection the conversation will happen.
Configure the F5
There are of course many ways of doing this, this guide will cover the basics and this should give you enough understanding to carry on building more complex deployments.
- Provisions the GTM module
- Create a datacentre
- Create links
- Create listeners
- Create a server
- Create a virtual server (LTM)
- Create a GTM pool
- Create a Wide IP
Provision the GTM module
The F5 BIG-IP Ve Lab edition on TMOS 11.3 is licensed for GTM, but it is not provisioned by default.
- System
- Resource Provisioning
- Check Global Traffic Management and select Nominal fromt he drap down
- Submit
- Reboot
Data centres act as coitainers for the various object and allows them to be logically grouped.
- Global traffic
- Data Centers
- Data Center List
- Create
- Specify a name such as Data_Centre1
- Finish
Links represent physical connection links to the internet. In the lab we have two ADSL lines, one with a fixed public routable IP the other with a dynamic IP, because of this one link would need translation and the other does not.
Create a fixed public rout-able IP link
Use this for creating a link for a internet connection that will always have the same fixed rout-able IP address
- Global traffic
- Links
- Link list
- Create
- Name IS_FixedIP
- Address Translation Disabled
- Router address 169.212.74.65
- UplinkAddress 169.212.74.66 (the ip you get from whatismyip.org)
- Data Centre Data_Centre1
- Health monitors bigip_link
Create a dynamic IP link
Note: the Uplink address is the IP that would be visible on the internet for the F5 itself. If you are not sure go to whatismyip.org and verify.
- Global traffic
- Links
- Link list
- Create
- Name Telkom_dynamic_IP
- Address Translation Disabled
- Router address 192.168.0.1
- UplinkAddress 105.221.130.246 (the ip you get from whatismyip.org)
- Data Centre Data_Centre1
- Health monitors bigip_link
Create Listeners
Listeners sit on the internet IPs of the F5 and listens for DNS requests. Listeners will show up a virtual machines in LTM
- Global Traffic
- Listeners
- Create
- Destination is the self IP
- Finish
- Repeat for the second public IP
You should end up with one on 192.168.0.254 and another on 169.212.74.66
These are the IP's and listeners we will be testing later on so keep this in mind when we get to the test pc.
These are the IP's and listeners we will be testing later on so keep this in mind when we get to the test pc.
Create a server
A server is a physical device that contains the virtual servers that are ultimately the destination of the DNS request.
A server is a physical device that contains the virtual servers that are ultimately the destination of the DNS request.
- Global traffic
- Servers
- Create
- Name: GTM_and_LTM
- Product: BIG-IP System (single)
- Add both Internet Self IPs to the address list (192.168.0.254 and 169.212.74.66)
- Data Centre Data_Centre1
- Health monitor bigip
- Virtual Server Discovery Enabled
- Link Discovery enabled
The server we just created needs contain virtual servers. The easiest place for this is to create a virtual server on the local LTM. In the lab I have a IIS web site an internal network.
- Local Traffic
- Pools
- Create
- Name pool_test_iis
- Health monitor http
- New Node (ip address of IIS site)
- HTTP
- Finish
- Local Traffic
- Virtual Servers
- Create
- Name vs_test_iis
- Destination Host (This ip is what will be returned in a DNS request - so this is a public ip)
- Service port HTTP
- Default Pool pool_test_iis
- Finish
A pool is a collection of virtual server that can reside on multiple servers.
- Global Traffic
- Pools
- Create
- Name gtm_pool_test_iis
- health monitor http
- Memberlist (Select the virtual server created in the previous step)
- Add
- Finished
A wide IP is a FQDN "DNS entry" that is mapped to the pool members This is essentially the dynamic DNS name that can return different ip addresses.
- Global Traffic
- Wide IPs
- Create
- Name: www.mytestdomain.com (this is the actual fqdn)
- Add the gtm_pool_test_iis to the pool list
- Finished
Testing GTM from the Internet
Generally the GTM would be an authorative DNS server on the internet. To test however we can simulate this by specifying the listener IP in an nslookup.
On your test internet connected PC
Open command prompt
nslookup
server 169.212.74.66 (your public ip specified in the listener)
now search for www.google.com - you should got no answer
now search for yourwide IP FQDN
You should get a reply with the IP specified in the LTM virtual server.
To test the same over the second ADSL link do the same but specify the nslookup server to be the other dynamic IP listed in the listeners. A note here. Since the dynamic IP can change it is not recommended to use one. It may be useful for testing but it is not feasable for any real deployment
Subscribe to:
Posts (Atom)





