What I have:
-------------
Ping-stat myserver #just one server
or
$myserverlist | ping-stat
Example of what I would like:
------------------------------
Ping-stat myserver #just one server
or
$myserverlist | ping-stat
or
ping-stat 10.0.0.0/24 -Net
What do you guys think would be the best way to accomplish this.
--
Brandon Shell
---------------
Stop by my blog some time :)
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
--------------------------------------
Right now I need a powershell version of '^' and '>>' Operators. Any Clues?
I dont see anything in about_Operators.
--
Brandon Shell
---------------
Stop by my blog some time :)
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
--------------------------------------
"Brandon Shell" <tshel...@mk.gmail.com> wrote in message
news:uGpqtCP...@TK2MSFTNGP06.phx.gbl...
You're better at PowerShell than I. I must be missing something in your
questions?
">>" as in this:
149# "test" >> testing.txt
150# gc testing.txt
test
And "^" to match things 'starting with'?
Marco
I am asking specifically asking about operators.
In C#
^ = Bitwise Exclusive Or (I did figure this out its -bxor in Powershell)
>> = Shift to right (meaning it adds 0 to the left and drops of the right)
<< = Shift to left (meaning it adds 0 to the right and drops of the left)
This is critical in determining what is the HOST and what is the Network in
an IP address. My problem ATM is that -band/-bor do not support UInt32.
I'm not sure where I stand now... this is gonna be really big pain if I can
deal with the bits.
--
Brandon Shell
---------------
Stop by my blog some time :)
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
--------------------------------------
"Marco Shaw" <marcoDOTshaw_@_gmailDOTcom> wrote in message
news:OTAg69Wc...@TK2MSFTNGP04.phx.gbl...
I tried creating a cmdlet for Right Shifting bits in bytes from powershell,
using the Compile-Csharp function published on the powershell Blog
Does anyone know how to Install a PSSnapIn that's compiled into an in-memory
assembly?
PS> Compile-Csharp 'using System;using System.ComponentModel;
using System.Management.Automation;[RunInstaller(true)]
public class DynamicSnapIn : PSSnapIn{
public DynamicSnapIn():base(){}
public override string Name{get{return"DynamicSnapIn";}}
public override string Description{get{return"DynamicSnapIn";}}
public override string Vendor{get{return "Me";}}
}
[Cmdlet("Shift","BitLeft")]
public class ShiftBitLeftCommand:Cmdlet{
[Parameter(Mandatory=true,Position=1)]public Byte subject;
[Parameter(Mandatory=true,Position=2)]public Byte modifier;
protected override void ProcessRecord(){WriteObject(subject >>
modifier);}
}'
PS> $dsi = new-object DynamicSnapIn
PS> $uninstallinfo = New-Object HashTable
PS> $dsi.Install($uninstallinfo)
Exception calling "Install" with "1" argument(s): "The path is not of a
legal form."
At line:1 char:13
+ $dsi.Install( <<<< $uninstallinfo)
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk
Looks like this:
80# [bwOperators.BitWise]::Band(2886844697,4294967040)
2886844672
81# [bwOperators.BitWise]::Bor(2886844697,4294967040)
4294967065
82# [bwOperators.BitWise]::Bnot(2886844697)
1408122598
83# [bwOperators.BitWise]::LShift(2886844697,2)
2957444196
84# [bwOperators.BitWise]::LShift(2886844697,23)
2357198848
85# [bwOperators.BitWise]::RShift(2886844697,23)
344
Although... honestly... I think i am just going to write this in C#. If I
have to load a .DLL might as well do it all.
It is really frustrating the bitwise operators don't support UInt32.
--
Brandon Shell
---------------
Stop by my blog some time :)
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
--------------------------------------
"Joris van Lier" <whi...@hotmail.com> wrote in message
news:%23v3KsZX...@TK2MSFTNGP02.phx.gbl...
function iptolong {
param([string]$ipaddress)
$a = [system.Net.IPAddress]::Parse($ipaddress)
[byte[]]$b = $a.GetAddressBytes()
$longip = 0
for ($i = 0; $i -lt 4; $i++) {
$num = $b[$i]
$longip = (($num % 256) * ([math]::pow(256,3-$i))) + $longip
}
return $longip
}
function longtoip {
param ($long)
return [system.Net.IPAddress]::Parse($long)
}
function ToBinary {
param($dec)
return ([system.Convert]::ToString($dec,2)).padleft(32,[char]"0")
}
function ToDecimal {
param($binary)
$binary = $binary.replace(".","")
return [system.Convert]::ToInt64($binary,2)
}
#EXAMPLE:
$address = "192.168.5.0"
$cidr = 24
$binaddress = ToBinary (iptolong $address)
$binmask = ("1" * $cidr).padright(32,[char]"0")
$binnetwork = ""
$binbroadcast = ""
for ($i = 0; $i -lt 32; $i++) {
$binnetwork += [string]( $binmask.Substring($i,1) -band $binaddress.substring($i,1) )
if ($i -lt $cidr) {
$binbroadcast += [string]( $binaddress.Substring($i,1) )
} else {
$binbroadcast += [string]"1"
}
}
$intnetwork = ToDecimal $binnetwork
$intbroadcast = ToDecimal $binbroadcast
#Check Results:
longtoip $intnetwork
longtoip $intbroadcast
Gaurhoth
"Gaurhoth" <gaur...@live.com> wrote in message news:eZa7lcac...@TK2MSFTNGP05.phx.gbl...