Let's start making sure I make my self clear: I still hate the Windows Powershell. Probably because each time I think about Monad, silly scripting languages like bash and VBScript come to my mind. And surely because I hate the easiness that is sold with these technologies, on which I don't believe. Did I mention I also hate the over-simplification and sourcecode savings that annoy me so much?
But as much anti PowerShell as I am, I could't help test driving it. Here's the story:
When I VPN to my company, I usually maintain my previous gateway and add the routing entries I need to work on my company's network. So I decided to do automate the operation using the Powershell. Here's the script:
#
# start VPN
#
RASDIAL "myVPN"
#
# get my VPN IP
#
$colItems = get-wmiobject -class "Win32_NetworkAdapterConfiguration" -computername .
$myIP = ""
foreach ($objItem in $colItems)
{
if ($objItem.Description -like "*PPP*")
{
$myIP = $objItem.IPAddress
}
}
write-host "my IP: " $myIP
#
# establish necessary manual routing
#
route add mySubnet0MASK 255.255.255.0 $myIP mySubnet1
route addmySubnet2 MASK 255.255.255.0 $myIP
route addMASK 255.255.255.0 $myIP
My conclusion is: for most silly Monad seems to be, there is a really need for scripting in this area. And for much it bothers me, not only to the IT people...
No comments:
Post a Comment