Struggling to get Powershell Runspaces right

2021.10.15 21:39 lolinux Struggling to get Powershell Runspaces right

Hello, for a few years now, off and on, I've been trying to understand Powershell runspaces.
Trying simple examples on the web, they "compile" and work as they should, but as soon as I try to integrate them my own needs, it's clear that there are things I didn't understand correctly.
For example, I want to make a script that would create snapshots of GCE instances using multi-threading.

#!/usbin/env pwsh [CmdletBinding()] param ( [string]$pattern = "lvms2", [string]$project = "v112-linux-VMs" ) <# This script is meant to be used for creating snapshots before Linux upgrades. Usage: ./create_line_snapshots.ps1 -pattern winvm -project pproj9 It will then search the provided project for that pattern in VM names, and create snapshots for all disks attached to the VMs #> Write-Host "Getting all VM instances..." $VMs = Get-GceInstance -Project $project | Where-Object { $_.Name -like "*$($pattern)*" } Write-Host "Found $($VMs.Count) machines: $($VMs.Name -join ', ')" if (@($VMs).Count -eq 0) { Write-Host "Didn't find any VMs. Cowardly quitting!`nI don't want to break stuff!" exit } # we need multithreading so that we don't wait for snapshots to be taken sequentially $RunspacePool = [RunspaceFactory]::CreateRunspacePool(1, 5) $RunspacePool.Open() $Runspaces = @() foreach ($VM in $VMs) { foreach ($disk in $VM.Disks) { $parameters = @{ "disk" = $disk "project" = $project "VM" = $VM "diskName" = $diskName } $Runspace = [powershell]::Create().AddScript({ Write-Host "Starting thread $_" $diskName = ($disk.Source -split '/')[-1] Write-Host "Will create snapshot called ${diskName}-linuxupgrade-$(Get-Date -Format yyyyMMdd) for $diskName that belongs to $($VM.Name)" -fore Yellow Add-GceSnapshot -Project $project -Zone (($VM.Zone -split '/')[-1]) ` -Label @{"billing" = $VM.Name } -DiskName $diskName ` -Name "${diskName}-linuxupgrade-$(Get-Date -Format yyyyMMdd)" }).AddParameters($parameters) $Runspace.RunspacePool = $RunspacePool $Runspaces += New-Object PSObject -Property @{ Runspace = $Runspace State = $Runspace.BeginInvoke() } } } while ( $Runspaces.State.IsCompleted -contains $False) { Start-Sleep -Milliseconds 10 } $Results = @() Write-Host "Please wait while the snapshots are being created" $Runspaces | ForEach-Object { $Results += $_.Runspace.EndInvoke($_.State) } $Results 
Now, what happens is that I get no error, since the error is in the runspaces.
Trying to explore those:
$Runspaces[0].Runspace.Streams.Error Add-GceSnapshot : Cannot bind argument to parameter 'DiskName' because it is an empty string. At line:6 char:49 + -Label @{"billing" = $VM.Name } -DiskName $diskName ` + ~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Add-GceSnapshot], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Google.PowerShell.Compute.AddGceSnapshotCmdlet 
Can anyone who hopefully has some experience with multi-threading shed some light? I thought I had experience with Powershell but I feel pretty stupid right now. Thanks
submitted by lolinux to PowerShell [link] [comments]


2021.10.15 21:39 doomtroll1978 In the mail from Hells Headbangers today

In the mail from Hells Headbangers today submitted by doomtroll1978 to TapeKvlt [link] [comments]


2021.10.15 21:39 Flimsy-Item-4287 Yinsu Artık Bizden Biri

Yinsu Artık Bizden Biri submitted by Flimsy-Item-4287 to anladimabi [link] [comments]


2021.10.15 21:39 Mublo 12k Followers Instagram Account

Selling my insta account with 12k followers on it
Account is completely cleared 0 posts 0 following
It was used as a meme page a few years ago
No idea how active it is and how many likes a post would get but you get what you pay for really and that’s just the follower count
Looking for around £30
Only message if you’re serious about buying. I want it gone
submitted by Mublo to GamingMarket [link] [comments]


2021.10.15 21:39 Dudy_15 optifine crashes minecraft forge 1.17.1 on a custom modpack if anyone knows how to fix it help me asap thank you

submitted by Dudy_15 to TLAUNCHER [link] [comments]


2021.10.15 21:39 jojodoodle I arranged the Berdly theme from Deltarune on Stardew Valley's flute blocks :D

I arranged the Berdly theme from Deltarune on Stardew Valley's flute blocks :D submitted by jojodoodle to StardewValley [link] [comments]


2021.10.15 21:39 scubasteve2242 What’s your unpopular opinion about hamsters? (Hamster care, enclosures, specifies, etc)

submitted by scubasteve2242 to hamsters [link] [comments]


2021.10.15 21:39 skylahginette Missing summer fashion already!

Missing summer fashion already! submitted by skylahginette to fairykei [link] [comments]


2021.10.15 21:39 Fast-Procedure-8432 Question about wedding officiant in NYC - do they have to renew annual?

Hi all
my fiance and I are having a hard time getting a court ceremony. I decided to ask around in my network. An old coworker is a registered officiant in NY since 2018ish. My question is: do NYC officiants have to re-register annually or once a registered NYC officiant ... always a registered NYC officiant?
thanks an any insight is helpful
submitted by Fast-Procedure-8432 to WedditNYC [link] [comments]


2021.10.15 21:39 Spitefullyginger I feel hurt but I feel like I shouldn’t be so I’m confused

So I’ve never had a lot of friends and usually when I have had them they end up just leaving me and then become strangers again. I’ve always felt like I was different from other people in the way that since people leave so easily I feel like I’m not cool enough or important enough to be close to others. For example if my friends were having dinner together and I wasn’t invited it doesn’t bother me cause I’m not important enough to be part of the group so to speak but I can hang out one on one with people. Because of all this when I find someone who acts like I’m important to them I get close to them fast and would call them important to me. Anyway I was just on the phone with one of my friends and I said “hey since you’re one of my best friends and I would like to think that I’m a close friend of yours” and she said “what? Haven’t known you that long. I would say we’re friends but we aren’t best friends.” And it kind of hit me hard and I started to cry while talking to her. I’m still very upset even though this happened 10 minutes ago. I’m not rethinking all my friends and wondering if they actually like me as much as I think they do. Does anyone else feel like this happens to them? How do you get over this? I’m very confused and upset.
submitted by Spitefullyginger to BPD [link] [comments]


2021.10.15 21:39 mycraftxes DYNO!

DYNO! submitted by mycraftxes to Memes_Of_The_Dank [link] [comments]


2021.10.15 21:39 Slug_Pr1ncess My mother always makes my birthday about her.

For context, she plans everything. I have a new job that requires me to work a lot of weekends. Because my father and my grandparents live far away, and the latter are elderly, I have decided to travel to see them on the Friday. Saturday I’m working, and Sunday (my birthday) I am spending with my mother and I had planned for my father to drive to see me in the afternoon/ early evening. She has told me that I use her as a doormat, because she had made all of these plans, of which I didn’t know about, on Friday and Saturday, despite a large portion of it being because of my work which no, I can’t get out of. She has shouted, screamed, cried and stormed around for days. Because of just trying to see my family, work, and accommodating her, I haven’t actually been able to see any of my friends or make any plans of my own. This happens every year; everything has to be about the plans she makes, and I don’t get a say. I don’t understand it either as she never does this when it comes to her birthday - of course, we always plan stuff and have a good time, but she never has this carry on. I’m just not sure what to do. I have grown to hate my birthday, and trying to establish boundaries always turns into an argument about how I don’t care about her, use her and am a toxic person. Any help?
submitted by Slug_Pr1ncess to Advice [link] [comments]


2021.10.15 21:39 Daca-P Did the Dutch car manufacturer DAF ever finish it's tank design/proposal?

I have been reading up on the Dutch armoured vehicle programme in the 1930's and the role of car manufacturer DAF in said programme. While researching I read somewhere that, around the time of the German invasion, DAF offered to build light and/or medium tanks for the Dutch war effort but this offer was refused. Later, after the war, DAF allegedly once again offered to build tanks for the Dutch army but this offer was also refused. I found this interesting but I wasn't able to find anything more about the proposals. I'm sorry if this question is a bit vague but, Is anything known about DAF's tank proposals? Names, Blueprints, Weightclass, anything about the design. Did they ever even finish the designs or did they just offer to start the design process?
submitted by Daca-P to AskHistorians [link] [comments]


2021.10.15 21:39 LaughingLizzyKawi 23/EST/PC New player looking for some new friends and good vibes

Hello Everyone,
I am a very new player to video games in general, with only a handful of hours under my belt.
I'm hoping to be able to meet a few people are willing to hangout and be patient while I get my feet under me in this new world.
More than anything, I am just hoping to meet a friend or two.

Game wise I have access to the following, through my own purchase or steam family sharing. I am also open to getting different games as needed.
- Rainbow six siege
- Counter strike global offensive
- 7 days to die
- Destiny 2
- Payday 2
- Rust
- Borderlands 2
- Halo master chief
- Garry's mod
- Valheim
- Warzone
- Apex
- Valorant
- Killing floor 2
- A hat in time
- Overcooked
- Phasmophobia

Outside of gaming I am always down to just talk about music, tv shows, current events or whatever else comes to mind!
Feel free to send me a DM or reach out to me on discord.
LaughingLizzy#3997

Cant wait to play!
submitted by LaughingLizzyKawi to GamerPals [link] [comments]


2021.10.15 21:39 kia0071 is bl1 worth playing?

i played bl2 and enjoyed it a lot so i though it would be better if i start the series from the first game.
I'm not familiar with the series so i would be appreciated if you guys guide me.
submitted by kia0071 to Borderlands [link] [comments]


2021.10.15 21:39 Careful-Sprinkles572 When should someone have their shit together?

submitted by Careful-Sprinkles572 to AskReddit [link] [comments]


2021.10.15 21:39 BobbyCostner Go, go to your fancy fire

Go, go to your fancy fire submitted by BobbyCostner to seinfeld [link] [comments]


2021.10.15 21:39 casualiandie 31F Who else likes modern folk music and clean comedy podcasts? And documentaries?

Hey all, just looking for some friendly boring conversation, and maybe a few new recommendations? I sure have a bunch myself if you’re interested:)
31F Who else likes modern folk music and clean comedy podcasts? And documentaries?
submitted by casualiandie to MakeNewFriendsHere [link] [comments]


2021.10.15 21:39 fierce_monger Dhoni's little hint that he will continue to play for CSK in IPL 2022 as well

Dhoni's little hint that he will continue to play for CSK in IPL 2022 as well submitted by fierce_monger to Cricket [link] [comments]


2021.10.15 21:39 Sea-Indepeny944 What has adderall done to your mind?

submitted by Sea-Indepeny944 to AskReddit [link] [comments]


2021.10.15 21:39 HannahLeap Discussion: Neutrality of Opinions

I had an interesting discussion with some people the other day who pointed out that they thought I was being "negative."
I'll give some context. We were discussing a singer that they were fans of. I made the comment that I did not like the way this singer's voice sounded when they used a particular technique.
Their feedback was this: That comment was negative, because it was not praise. Also, a neutral opinion is only one that's unspoken.
Now... this got me thinking.
I view "like" and "dislike" as neutral. I view "love" and "hate" as the positive/negative that they were referring to. An unspoken or non-opinion, can't be neutral, because it doesn't exist in the energetic sphere of conversation. Meaning, it isn't a part of a conversation at all.
I feel as though positivity/negativity (in this context) are the result of an emotional response, which is non existent in like/dislike.
For example: I decide to order a pizza. I ask for no olives because I dislike them. The pizza place makes a mistake and adds olives anyway. The presence of olives on my pizza does not elicit an emotional response. I simply pick them off and continue on.
Alternatively: I ask for no olives because I hate them. The pizza place makes a mistake and add olives anyway. The presence of olives on my pizza makes me disappointed, angry, and sad. I probably call to complain, leave a bad review, or make Facebook post about it.
Thoughts?
submitted by HannahLeap to Pholosophy [link] [comments]


2021.10.15 21:39 xcxnextlevellarn plz stop asking the community to diagnose you

please get professional help! do not diagnose yourself and do not ask people on reddit to do this. mental illness is not a one size fits all, it looks so different from person to person. i know this is probably said all the time but it's so frustrating to see people (especially teenagers) on here be like "am i bipolar???? i do this and this and this."
if you are concerned, please reach out to those around you and get professional help. continue to ask for advice, of course, but please take care of yourself!
submitted by xcxnextlevellarn to BipolarReddit [link] [comments]


2021.10.15 21:39 Kiriv National Unity coalition negotiating for Democrats support 1936 colorized

National Unity coalition negotiating for Democrats support 1936 colorized submitted by Kiriv to Kaiserreich [link] [comments]


2021.10.15 21:39 EmotionalAlps5326 G

G submitted by EmotionalAlps5326 to fortsex [link] [comments]


2021.10.15 21:39 Safety-International What's with the massive drop today in Deep Yellow? In this sector the losses can be dramatic to my portfolio, it is eating my gains.

What's with the massive drop today in Deep Yellow? In this sector the losses can be dramatic to my portfolio, it is eating my gains. submitted by Safety-International to UraniumSqueeze [link] [comments]


http://vitrage-tmb.ru