Here’s a helpful tip for controlling Internet Explorer w/ Windows PowerShell.
First Create an instance of IE:
$ie = new-object -com InternetExplorer.application
Then, tell Internet Explorer to become visible:
$ie.visible = $true
Next, tell Internet Explorer where to go:
$ie.navigate2("http://powershell.ws/")
Of course there are lots of other things you can do with Internet Explorer using PowerShell. If I can find time, I’ll put them in a new One Hour Expert edition, but for now this should get you started.
Enjoy.
I have an absolute fascination with the Fibonacci sequence. In a few minutes of rare idle time I threw together a PowerShell function to generate Fibonacci numbers.
Just plug in how many numbers you want generated as the function’s argument and off you go. It’s so basic that just by modifying a few lines one could easily translate it into PHP orJavaScript.
function zfib($stop){
##By Zeaun Zarrieff
$a = 0
echo $a
$b = 1
echo $b
for($i=1;$i -le $stop;$i++){
$c = $a + $b
echo $c
$a = $b
$b = $c
}
remove-variable -name a
remove-variable… Continue reading Did you know that you could control Windows Update from the command line? If you didn’t, you’re not alone. I’d estimate that 98% of certified Microsoft professionals have no idea about this.
“Why is this important”, you ask? because if you can do it at the command line you can script it, and if you can script it you can deploy it.
Here’s the deal:
The command for controlling Windows update is, “WUAUCLT.exe”. Used by it self it doesn’t do much, but when you combine it with the command line switches listed below, it becomes a very powerful utility indeed.… Continue reading
As an administrator you already know if your target system is 32bit or 64bit, but that is not immediately true for your Powershell scripts.
Why you need this:
If you need to run any opration (such as a software installation) differently depending on whether a system is 32-bit or 64-bit.
Why I came up with this:
I used to do this by running an if query against the $env:programfiles(x86) but I quickly realized that this was not the most efficient way of determining this. Instead I have derived the following:
$test = get-wmiobject win32_computersystem
if ($test.systemtype -like "x64*"){command_or_executable_to_be_run}
The above… Continue reading