Pseudo-scrip easy, but PowerCLI, too?

Hello. I'm testing a personal path MRU lun balancing script. I developed nickname - the following algorithm, and I would like to turn/convert it into PowerCLI. I would do exactly this:

Hostname = 'Server1 '.


Cont_Fix = 1
Cont_MRU = 1


For each host name logic unit number


# Get the number of paths to the LUN:
NumPaths = LeerNumPaths (Mon)


# Paths to a LUN balancing sets:
If (Lun = fixed) then
# The technical set up a path for the fixed LUN and play
# with a module to determine what path might be preferred in each case.
Configure_Path - Lun lun = - PreferredPath = (Cont_Fix Mod NumPaths) + 1
Cont_Fix = Cont_Fix + 1
End If


# Paths a MRU LUN balancing:
If (LUN = MRU) then
Path_To_Set_Enabled = (Cont_Mru Mod NumPaths) + 1


(# The technical is: 1) deactivation of all paths, except one, who will take the active role:


Path_Count = 1 To NumPaths Do
If Path_Count <>Path_To_Set_Enabled then
Disable_Path - Lun = Mon - Path = Path_Count
End If
End for


(# 2) we turn again on the path to normalize the status of the LUN:


Path_Count = 1 To NumPaths Do
If Path_Count <>Path_To_Set_Enabled then
Enable_Path - Lun = Mon - Path = Path_Count
End If
End for


Cont_Mru = Cont_Mru + 1

End If

End for


If Get_Paths_Disabled then
Say 'Oops. You should review disabled access roads.
On the other
Say "Yes".
End If

It is possible to convert this power-CLI Pseudo-script?

Thank you in advance!

Kind regards.

The following script PowerCLI is an implementation of your pseudocode. I didn't actually test the script. So it does not work the first time you run it.

$HostName = "Server1"

$Cont_Fix = 1
$Cont_MRU = 1

foreach ($LUN in (Get-VMHost -Name $HostName | Get-ScsiLun))
{
    # Get the number of paths for the LUN:
    $ScsiLunPath = $LUN | Get-ScsiLunPath
    $NumPaths = $ScsiLunPath | Measure-Object | Select-Object -Property Count

    # Balancing paths for a Fixed LUN:
    If ($Lun.MultipathPolicy -eq "Fixed")
    {
        # The technique is configure a preferred path for the Fixed LUNs and playing
        # with a module to determining which path can be preferred in each case.
        Set-ScsiLun -ScsiLun $LUN -PreferredPath $ScsiLunPath[($Cont_Fix % $NumPaths)+1] -Confirm:$false
        $Cont_Fix += 1
    }

    # Balancing paths for a MRU LUN:
    If ($Lun.MultipathPolicy -eq "MostRecentlyUsed")
    {
        $Path_To_Set_Enabled = ($Cont_Mru % $NumPaths)+1

        # The technique is: 1) Disabling all paths except one, which will have taken the active role:

        for ($Path_Count=1;$Path_Count++;$Path_Count -le $NumPaths)
        {
            if ($Path_Count -ne $Path_To_Set_Enabled)
            {
                Set-ScsiLunPath -Active $false Disable_Path -ScsiLunPath $ScsiLunPath[$Path_Count] -Confirm:$false
            }
        }

        # 2) We again turn on the paths to normalize the status of the LUN:

        for ($Path_Count=1;$Path_Count++;$PathCount -le $NumPaths)
        {
            if ($Path_Count -ne $Path_To_Set_Enabled)
            {
                Set-ScsiLunPath -Active $true Disable_Path -ScsiLunPath $ScsiLunPath[$Path_Count] -Confirm:$false
            }
        }

        $Cont_Mru += 1
    }
}

if ($ScsiLun | Get-ScsiLunPath | Where-Object {$_.State -ne "Active"})
{
    "Oups. You need to review disabled paths"
}
else
{
    "Yeah."
}

Tags: VMware

Similar Questions

  • I normalizes some physiological signals on the y-axis (easy), but how I standardize on the y-axis?

    I normalizes some physiological signals on the y-axis (easy), but how I standardize on the y-axis?  The waveforms range from a length of 200 to 500 datapoints.


  • Microsoft Paint - Image is normal on screen but prints too small?

    Microsoft Paint - Image is normal on screen but prints too small?

    When I'm in the paint all my settings are the same that I use always and my image appears normal size on the screen but when I go to print I put it on the scale to fit on page 1 x 1 (so it's all about a piece of paper), but then I have print preview and the image is just a 1-inch picture in the upper left corner. I had done several times in the past and never had a problem. Why does the image offset? Also when I remove the scale down to 1 x 1 page it can tile the image on 4 pages. So if the image is the great whys it shrinks it do much when I as a single piece of paper? Help!

    Go to the options of paint by clicking on the top left of the menu bar icon (the one to the left of the 'Home' that looks like a sheet of paper lined w / an arrow next to it).  Choose 'Properties' from the menu drop down.  Keys to your measurements of paper (ie. 8.5 x 11 "or 8.5" x 14) depending on the direction you have chosen - portrait or landscape (under print options: Page layout) which should solve your printing problem.  Unfortunately, the program seems to use some default preset every time that you open the Paint program.  That's how I came across your question;  I'm trying to find how to change the default setting. During this time, I guess that we just have to continue to change it before printing.

  • I used the snap, but went too far with the mouse that has placed the window out of view on the desktop. How I suddenly back

    I used the snap, but went too far with the mouse that has placed the window out of view on the desktop. How I suddenly back

    Try clicking on the Chrome icon & press f11 to maximize the screen.

    Kind regards

    Nicholas Lee Fagan

  • ﷯Error - error message: an element on the page "News" at location 33 642 requires the pixelation, but is too large to rasterize. Resize it smaller and try again... I can't fix this or find that the line number.  How can I find this line?

    ﷯Error - error message: an element on the page "News" at location 33 642 requires the pixelation, but is too large to rasterize. Resize it smaller and try again... I can't fix this or find that the line number.  How can I find this line?

    I don't know why it worked, but I changed the police and was able to download Web site.  Thanks for your help!

  • Easy, but I can not... Global variable

    Project: having two projectors and communicate with each other. Note that the two projectors would be on the same system

    Details: using Director 11, Windows

    For the movie ' set the Variablel so far, I (through the online guide Deans).

    This is for "movie 1»

    =========================================

    global gGlobalVar

    on setGlobalVar

    gGlobalVar = 35

    end

    =========================================

    Code for 2nd projector

    For the film, which "Gets the global variable" defined by "feature 1". "

    =========================================

    global gGlobalVar

    on getGlobalVar

    Put gGlobalVar in field ("databank")

    end

    Globals can be written anywhere, and they must work in all of the films in a projector. But they won't work between two different projectors. You can try to use Flash city, it is not easy, but it can work. Here's some information about it:

    http://help.Adobe.com/en_US/Director/11.5/UsingScripting/WSc3ff6d0ea77859461172e0811d50262 762 - 7f1c.html

  • An enemy following me around the screen, but not too fast

    Hi, I'm building apps to teach English but through games.

    I want an enemy BUG following me around but NOT TOO soon as I have small children of 5 years using it,

    It would be something like the details of my HERO character and to send the BUG.

    I use the POINT at the moment to send my HERO to where the mouse clicks.

    I could send the BUG there as well but using less x and y increments.

    It would be too heavy for the processor - too much going on with the music as well?

    still, do not remove:

    var speed: Number =. 99;

    public void onEnterFrame(event:Event):void {}

    var xDistance:Number = clickPoint.x - this.hero.x;

    var yDistance:Number = clickPoint.y - this.hero.y;

    If (Math.abs (xDistance) > 10) {}

    var angle: Number = Math.atan2 (yDistance, xDistance);

    This.Hero.x += v * Math.cos (angle);

    This.Hero.y += v * Math.sin (angle);

    } else {}

    this.hero.gotoAndPlay ("static");

    }

    enemy1.x = speed * enemy1.x +(1-speed) * hero.x;

    enemy1.y = speed * enemy1.y +(1-speed) * hero.y;

    If {(clickPoint.x>=hero.x)}

    this.hero.gotoAndPlay ("right");

    trace (Math.ABS (xDistance));

    }

    If {(this.hero.x>=clickPoint.x)}

    this.hero.gotoAndPlay ("left");

    trace (Math.ABS (xDistance));

    }

    }

  • LR 2: workflow colorproofed but prints too dark. Help, please.

    Hello

    I'm new here. I have read all the other threads on this problem and tried all the proposals. But I can't solve the problem.

    In detail:

    IMac

    Progs: CS 2, CS 4, LT 2

    Printer: HP Photosmart B 9180

    Display: iMac + Eizo CG21

    ColorProof by eye - one display and colorvision spectrophotometer for printers.

    I even put the brightness and Gamma of the monitor for each type of paper measuring the brightness/white paper.

    In CS 2 all works very well. 100% matching printmakers.

    In LR 2: too dark images. Printer has the default value. Color-correct profile is selected. Printer is set up for color management software...

    If I send the same image of LR2 to PS2 to modify, print in PS2 without changes, everthing is ok.

    CS 4: Too dark prints as in LR2

    Help, please! I love LT2 to manage the huge amount of images and you want to use for printing photobooks (easier to print if you want to print pictures 20 or more...)

    Anyone have more tips?

    Thanks in advance

    I have the same setup as you, perhaps with the exception of the osX version (10.5.7).

    The impressions of my B9180 are thin and assorted in color managed LR and printer managed.

    Wheter that the printer is set up by default or not never made no difference.

    My printer driver version is 2.3.3

    However, I have the same problem with another printer and LR.

    The fact that people with the same configuration and drivers get different results only confirm my idea that there is a bug / flag in LR who gets together and then all your prints for a certain printer is screwed up.

    I am rather disappointed that Adobe has not corrected this and seems even to the same bug in CS4.

    I won't pay for LR or CS4 until I have confirmation that this bug is gone (if I were to upgrade to CS4 and get the same problem, I would not be able to print over all)

  • MacBook Air storage issues - I have iCloud but using too much data, which is a better solution?

    I have a Macbook Air processor intel and storage 4 GB, I use iCloud for storing all my data, but recently I had a problem with too much use of my data internet home. We are limited because we live in a rural area. So I guess I have two questions: 1) can I use an external hard drive to avoid having to use my iCloud? and if I do which is the best to use external storage drive? I have a lot of files and photos, I am a real estate agent. I got this Macbook Air since September 2015 still invite us to her also. Next question, can I use another Mac with a bigger hard drive instead of the MacBook Air? My son told me in the Macbook air because of its features, but the storage for me is imperative. Please notify

    Use many small external drives that you can carry in your pocket that connect to the computer via USB 3.0. Shop for them at Amazon.com.

    BTW, 4 GBs is the memory of the computer, no storage. MBA come with built-in SSD from 128, 256 or 512 GB capacity. You choose the MBA with the SSD model that best fits. However, once you make the computer cannot be updated.

  • On my old PC I printed labels either individually or an address of a page of labels Avery... it was easy, but it seems very complicated with Apple

    I have an iMac OSX El Capitan.  10.11.2 version... labels I printed on my old PC or all pages of a single address or unit... it was easy

    but seems a very complicated process with Apple!

    How can I do

    The labels are extremely simple to print under OS X. Please watch over address book: printing mailing labels or envelopes with several names--Apple Support

  • Internet works but lagging too!

    Hello world

    Internet works but the problem is that when I click on any site it lag! After several times of refreshing it doesn't work all the time.

    YouTube works, but other sites are too slow?

    I have antivirus and search for viruses, but there is no virus

    What to do please help me :(

    Hello

    Run a trace and discover where the offset occurs.

    Download this program trace, http://www.d3tr.de/download.html

    Use the Trace as the list item

    Output should look like this,

    The table shows the result of the ping my computer via a router Buffalo multi 96.6.68.195 * website

    The important columns in the table (for this discussion) are the two in the middle. E.g. ms min. and Max ms.

    The numbers it shows a typical result. The progression of the trace on the Internet, measures the change in change radically.

    While the change on my router is 1 ms, and the connection to the server of the ISP direct is 2ms, subsequently, the variation is so almost 20ms.

    Practically this means?

    We should run a trace similar to his favorite games IPs, and if the first digit on the table a variation greater than the late cleaner number we should get a new router.

    * The number of IP target is a server Akami. AkaMi servers are probably the best server on the Internet system far exceed the majority of game servers.

    Jack-MVP Windows Networking. WWW.EZLAN.NET

  • skinning spark scroller - seems easy, but does not

    Hello

    I'm trying to define a custom vertical scroll bar by incorporating images right in the skin for each of the pieces of skin increment, decrement, follow and thumb.

    The problem is that I am not able to hold the 'thumb' and move upwards or downwards. He behaves as if I clicked on the track to increment the top or bottom of a step.

    Also, if I try to place a 'thumb' like a white image on a gray track, the thumb is not at all visible. The thumb was visible when I placed a gray image darker on a trail of light gray. He is so boring, I couldn't guess what was going on...

    help everything I could find on google, is that they use default spark.skins.spark(VscrollBarThumbSkin|) VScrollBarTrackSkin), but I don't want to use it.

    It was pretty easy in mxml comps by definition upskin, downskin etc in css itself, now I am struggling with the spark.

    Any help is greatly appreciated.

    Here is my statement in the css style-

    s | {VScrollBar

    skinClass:ClassReference('assets.skins.VScrollBarSkin');

    }

    My VScrollBarSkin-

    < s: states >

    < s: State name = "disabled" / >

    < s: State name = "normal" / >

    < s: State name 'dormant' = / >

    < / s: states >

    < s:Button id = 'decrementButton' top = "0" left = "0"

    width = "20" height = "20"

    focusEnabled = 'false'

    skinClass="assets.skins.VScrollBarUpArrowSkin"/ >


    < s:Button id = 'incrementButton' bottom = "0" left = "0"

    width = "20" height = "20"

    focusEnabled = 'false'

    skinClass="assets.skins.VScrollBarDownArrowSkin"/ >


    < s:Button id = 'thumb' high = low "0" = "0"

    width = "20" height = "30"

           right="2"

    focusEnabled = "true"

    skinClass="assets.skins.VScrollBarThumbSkin"/ >


    < s:Button id = "track".

    width = "20" height = "100%"

    top = '20' low '20' = left = '1' right is "2"

    focusEnabled = 'false'

    skinClass="assets.skins.VScrollBarTrackSkin"/ >

    -My skin to 'decrementButton' and "incrementButton" works very well. It incorporates only top-arrow/arrow image respectively.

    -My skin of thumb is-

    < s:SparkSkin >

    < s: states >

    < s: State name = "rise" / >

    < s: State name = "low" / >

    < s: State name = "over" / >

    < s: State name = "disabled" / >

    < / s: states >

    < s:BitmapImage

    height: ' 100 percent ' width = ' 100% '

    ( source.up="@Embed('assets/images/thumb-1.jpg') '

    ( source.over="@Embed('assets/images/thumb-1.jpg') '

    source.down="@Embed('assets/images/thumb-1.jpg')" / > "

    < / s:SparkSkin >

    -My skin of track is-

    < s:BitmapImage width = "100%" height = "100%".

    ( source="@Embed('assets/images/scrollBar/scrolltrack.png') '

    />

    Hi lakshdn,

    To the skin of your scroll bar, try it in the following order:


         width = "20" height = "100%".

    Top = '20' low '20' = left = "1" right = "2".

    focusEnabled = "false".

    skinClass="assets.skins.VScrollBarTrackSkin"/ >

    width = "20" height = "30".

    right = '2 '.

    focusEnabled = "false".

    skinClass="assets.skins.VScrollBarThumbSkin"/ >

    Top = "0" left = "0".

    width = "20" height = "20".

    focusEnabled = "false".

    skinClass="assets.skins.VScrollBarUpArrowSkin"/ >

    low = "0" left = "0".

    width = "20" height = "20".

    focusEnabled = "false".

    skinClass="assets.skins.VScrollBarDownArrowSkin"/ >

    where all parts of skin have focusEnabled = 'false', the constraints of up/down of the thumb has been removed, and the order of the parts appear as above. The order of the elements is important because stacking on screen order begins with the first component on the bottom. I think the problem you were having was that 'track' has been placed after the 'thumb '. This means that on screen, the 'thumb' is in fact under the rail so that when you click on the thumb, you're always clicking on the track. Let me know if you have more questions or problems.

    Hope this helps,

    -Kevin

  • Firefox hijacked on various websites (for most games facebook and such but others too) at random times.

    I'll be on a site and suddenly it will redirect to another site. This can happen at any time, sometimes as soon as a window, sometimes the window can be opened for a period of time before it happened or may not happen at all. It doesn't have any link to this site I am on (the same site can immediately redirect once and not an hour of the next). I can always use the back browser button to return to the original site. About 75% of the time in this case, I find myself on a login page Facebook and when I come back I see the original redirect went to some Facebook game/meetings/or some of these sites, none of which I have never used. I do not have Facebook but I do nothing on it except go to my wall to see photos and messages from my family (5 ' friends'). I've never even posted a comment. The other 20% of the time, he goes to various sites like surveys, supports your vet.org, or those with letters and numbers just randomly.
    Regarding the question "It happened" that follows I often 3-5 windows open at a time and it will happen 20 or 30 times less than an hour 4 window.
    I tried Internet Explorer and Google Chrome since it started, and this has not affected one of them. I even tried to run each at the same time as Firefox and they are kept, while Firefox pages were diverted.

    Hi mha007, I ran Firefox 2 days in mode 'safe' with no redirects, then 2 days normal running with no redirects, so the problem seems to be resolved. I ran RogueKiller so I guess he must have eliminated some maleware was the origin of the problem. Thank you for your help.

  • I want to go back to Firefox 4, where can I find a download of Firefox 4? Finally, I will use FF5, but earlier too Add ons are not available

    where can I find a download of Firefox 4, I feel uncomfortable with FF5 because so many modules are still missing, I'll eventually use FF5, but right now I want to go back to nr. 4

    Try using the add-on Compatibility Reporter to override compatibility.

    https://addons.Mozilla.org/en-us/Firefox/addon/add-on-compatibility-reporter/

    Firefox 4 versions are not supported by updates to security that are included in Firefox 5.0 and Firefox 3.6.18. If you go to 'return', use 3.6.18 instead.

    http://www.Mozilla.com/en-us/Firefox/all-older.html

  • icons, star bar and task bar not missing but appearing too slow

    Hello! The my problem are the icons, the bar start and taskbar. They are not lacking, but his appearance hours after having turned on the computer. In safe mode, they appear quickly, but in this mode, I can't do a lot of things. What can I do to fix that?

    Info about my computer:
    System: Microsoft Windows XP Professional Version 2002 Service Pack 3
    Computer: AMD Sempron (tm) Processor 3200 + 1.80 GHz, 896 MB of RAM

    Safe mode is essentially Windows running with the bare minimum of starting programs and processes... so if safe mode behaves correctly but normal isn't, this suggests that there is a nonessential program or process that normally runs at startup which is interefering or cause this problem.  The general approach to finding and fixing this problem is a tedious process and iterative where you use "msconfig" to disable processes that run at startup in groups (reset after each iteration) until you narrow in on one that is causing your problem.  The whole process is described in the following article:

    "How to solve configuration errors by using the System Configuration utility in Windows XP"
      <>http://support.Microsoft.com/kb/310560 >

    FWIW, there is also an equivalent to msconfig program called "AutoRuns" that is provided as freeware from Microsoft

    AutoRuns: <> http://technet.microsoft.com/en-us/sysinternals/bb963902.aspx >

    HTH,
    JW

    PS: Sometimes you can get these bar of tasks & icons appear at the request by typing "Ctrl-Alt-Del" to bring up the Manager tasks.  Once the Task Manager is running, select the file-> new task, and then type in "explorer".

Maybe you are looking for