Powershell script to enumerate server serial number, name, manufacturer

Requires an associated txt file with a list of server names/ ip addresses.

—————

#Pings a list of IP addresses, pulls the serial number, manufacturer and computer name from responsive computers

del C:\Support\Scripts\hardware\dellHardware.txt

#Reads from a list of servers
get-content c:\Support\Scripts\Hardware\dellST.txt | Foreach-Object {

#Sets $Result variable to output of test-connection
$Result = test-connection $_ -Quiet

#If $Result is false (i.e. this machine can’t connect to the remote server),
#Send an email out to support staff saying the remote server is down.
if ($Result -eq $True)
{
$details = Get-WmiObject win32_SystemEnclosure -ComputerName $_ | Select SerialNumber,PSComputerName,Manufacturer}
Add-Content -Path C:\Support\Scripts\hardware\dellHardware.txt $details
}

Weird Windows 8 Update error #2

Hmm. Still haven’t got to the bottom of this.

I decided to start updating in “blocks” from the GUI on the basis that I would quickly enough figure out which block of updates was failing on my host machine. So… starting with 49 updates, I installed several batches (starting with .Net) and all went fine until I was down to 15 updates. I then selected the bottom 8 (the last 15 are all just “Update for Windows 8” updates) and this broke my host. So I reverted (using system restore- this is important! Create as many restore points as you need to revert back to…), then tried a different random 5 and these worked. From these last 10 I then tried 2 more, but these broke my machine. My PC then went really crazy and I struggled to get it back, but now- instead of having the same 10 left, I know have 14 updates and I don’t think they’re all part of the original 15 I was down to. More to follow…

EDIT 30/MAY/2013 @ 10:14- Just tried install KB 2768703 and it failed, 100%. So there’s something up with this update, even if it’s not the one causing the update process to fail and revert back.

Server core #02

After a week of playing around with server core I’d say it’s worth sticking with. There’s a bit of a learning curve, but it gets easier to use precisely because you can’t do anything “normal” with it. There’s no explorer, no IE, no control panel etc. You can still install normal programs (such as MDT and WAIK) but basically you end up only using the same few commands over and over again because that’s all you can do. The only thing I’d imagine is tricky is IIS; there seem to be a lot of IIS options to install when running dism /online /get-features so I’d imagine it’s tricky getting the right combination.

iSCSI #01

Think I’ve finally nailed this. With help from various sites, I’ve now got two commands which seem to work after running the iscsicli addtarget command. It’s really important to count how many *s and spaces there are- so the first example starts off T<space>*<space> etc.

iscsicli PersistentloginTarget <IQN> T * * * * 0 2 0 0 * * * u p 1 * *

In order, 0 = set security to none, 2 = enable multipath, 0 = sets header digest, 0 = sets data digest, u is your CHAP username, p is your chap password, 1 = set authentication type to CHAP. I think you can ignore the *’s, they do things but not sure how important they are.

iscsicli loginTarget iqn * * * <INI> <INIPRT> * * * * * * * u p 1 * *

<INI> = initiator name which can be found with iscsicli listinitiators, <INIPRT> = I think should be 2, ensures you know which NIC port is connecting, and u, p and 1 as above.

Fun with server core #01

Server core feels a bit like when you wake up with a jolt thinking you’re somewhere unfamiliar. You can do very little, and the little you can do is radically different. So installing hyper-v involves typing weird commands like

Dism /online /enable-feature /featurename:Microsoft-Hyper-V

Which will get you hyper-v, but won’t help with iSCSCI for example. On that note, MS have (thankfully) left a GUI version of the iscsi initiator which can be invoked by typing iscsicpl.exe. I’d actually rather get to grips with iscsicli.exe, but from my limited experience it’s fond of reporting everything as good and connected when in fact it’s anything but. I’ll post more about iscsicli.exe when I get it working but for now am just going to use it in conjunction with iscsicpl.exe so that I can learn what does what.

Disabling NICs through server core

This is easy tho’ you’d never have guessed.

Firstly, type

netsh interface ipv4 show interfaces

and carefully note the Idx numbers of your interfaces.

Next, type

netsh interface ipv4 set interface interface=xx disabled

replacing xx with Idx numbers from above. Just remember not to disable the interface you’re working on!