UK PowerShell group–next two meetings
Posted by: Richard Siddaway
29 May 2012
PowerShell and Windows server 2012 – new functionality pt 2
29 May 2012
PowerShell and Windows server 2012 – new functionality pt 2
At some stage we may need to reset our NIC back to having a static address
$index = 7 $nic![]()
0 Comments
RSS Feed
Email a friend
May 17, 2012 1:04 PM
Scripting Games 2012 comments: #20 multiple ifs
Posted by: Richard Siddaway
PowerShell
An if statement is used to test a condition and if is true do one thing and do another if it is false. It can be written generically as
if (<condition>){ do stuff}
else {do other stuff}Sometimes we need to test numerous alternatives. We could use multiple if...
May 16, 2012 3:12 PM
TCP/IP Alternative Configuration: pt II Set DHCP
Posted by: Richard Siddaway
Network, PowerShell, WMI
The next step on our journey to an alternative configuration is setting the NIC to use DHCP
I will keep cheating for now and specify the NIC – on my machine I now it is the NIC whose Win32_NetworkAdapterConfiguration has an Index of 7
![]()
0 Comments
RSS Feed
Email a friend
May 16, 2012 1:50 PM
Scripting Games 2012 comments: #19 default parameters
Posted by: Richard Siddaway
PowerShell
I often saw scripts that did something like this
function test1 { param ( ...May 15, 2012 3:26 PM
Scripting Games 2012 comments: #18 computer names
Posted by: Richard Siddaway
PowerShell
I have mentioned computer names a few times. One oddity is accessing the local machine.
There are three options
- dot .
- localhost
- $env:COMPUTERNAME
There are a number of occasions when . and localhost fail.
For...
May 14, 2012 3:23 PM
Test-Connection oddities
Posted by: Richard Siddaway
PowerShell, WMI
I’ve playing around with Test-Connection because I wanted to set up a long running WMI based job and I thought that pinging a machine lots of times would be a good way to do it. Test-Connection uses the Win32-PingStatus class.
I started with this
![]()
0 Comments
RSS Feed
Email a friend
May 14, 2012 11:21 AM
Scripting Games 2012 comments: #17 opening a csv file
Posted by: Richard Siddaway
PowerShell
Some of the events involved creating a CSV file. While it wasn’t explicitly asked that you opened the file many entrants chose to add that code to their scripts.
There were a number of options presented – most involving opening Excel and importing the CSV file.
There is a...
May 13, 2012 11:25 AM
Scripting Games 2012 comments: #16 reading environmental variables
Posted by: Richard Siddaway
PowerShell
Windows maintains a set of environmental variables. Some, but not all, can be seen via the env: PowerShell drive
Get-ChildItem -Path env:
You can also use WMI to see some of the variables
Get-WmiObject -Class Win32_Environment | ft Name, VariableValue –a
...May 13, 2012 10:34 AM
TCP/IP Alternative Configuration: pt I The configuration
Posted by: Richard Siddaway
Network, PowerShell, WMI
A question on the forum got me wondering about setting the Alternative Configuration on a TCP/IP properties of a network adapter. NICs are normally configured to either DHCP or a static address. If you use DHCP another tab “Alternative Configuration” appears on the IPv4 properties dialog....
