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 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