Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-Type @'
- public class CPObject
- {
- public int id;
- public string name;
- public string displayname;
- public string classname;
- public string ip;
- public string netmask;
- public string ManagementServer;
- }
- '@
- Function NameToIP {
- Param([int]$id=0, [string]$name="")
- $CPObject = $CPNetworkObjects | Where-Object { $_.id -eq $id -and $_.name -eq $name }
- If($CPObject.count -eq 1){
- $CPObject.ip
- } else {
- ""
- }
- }
- $NameToIP = @{}
- Foreach ($Object in $Array) { $NameToIP["$($Object.id)_$($Object.Name)"] = $Object.ip }
- Function NameToIP {
- Param([int]$id=0, [string]$name="")
- $NameToIP["$id_$name"]
- }
- PS>(1..15000) |%{
- >>> $res+=new-object pscustomobject -property @{"id"=$_;name=(get-random)}
- >>> }
- PS> measure-command -expression {$res |?{$_.id -eq 14999 -and $_.name -eq 513658722}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement