|
Can someone point me to a VSCode and Git/VSTS for dummies blog post?My team has no version control whatsoever and this should be an easy thing for me to set up and get brownie points for. I've barely managed to get VSCode set up with a couple plugins for Powershell and VSTS. I tried setting up a Git repository in VSTS and I think I've managed to get VSTS to commit to my local repo but I can't get the changes to sync to VSTS.
|
# ¿ Aug 10, 2018 02:48 |
|
|
# ¿ Apr 29, 2024 04:29 |
|
Pay no attention to the man behind the curtain
|
# ¿ Aug 24, 2018 18:58 |
|
What do you all use for version control? I've been trying to set up Git at work, and either Git is obtuse, I'm dumb, or both. What I want is a repository that lives on an internal file share with the authoritative versions of those files actually stored there. I want something as close to seamless as possible for an ISE like VSCode (or whatever) to be pointed at that file share (repo, whatver) and natively edit those files with changes silently synced without having to muck around with the command line with every save. Our infrastructure is set up in such a way that scripts need to be ("need to be") locally edited on a variety of machines. Right now we use the ISE and frequently hear "wait a minute, this is the wrong file, I know I fixed this the other day, where is it" and queue the half hour of searching or re-coding. While testing, I managed to get VSCode doing that with a cloud hosted repo on VSTS, but cloud hosted won't work in production for a variety of reasons. So now I'm trying a bunch of variations of code:
Help?
|
# ¿ Sep 29, 2018 19:53 |
|
Jesus gently caress I don't understand any of this. Using VS Code to sync which does a pull and then a push.code:
I can use a bare repo as my remote (cloning the repo locally and then committing and pushing to the remote) works. loving finally. But the files all live on my workstation, since it's a bare repo. OK. Make a bare repo, clone it to another folder on the server. Clone that other folder locally. Pull and push. Same loving error. What the gently caress.
|
# ¿ Oct 1, 2018 21:54 |
|
When I do Invoke-VMScript in PowerCLI - which feeds strings of code into a VM - and I need to dynamically update variables, I call the variable #variable and then to a $string.replace(#variable,$variable). For instance:code:
Happiness Commando fucked around with this message at 18:31 on Nov 12, 2018 |
# ¿ Nov 12, 2018 18:28 |
|
slartibartfast posted:If you're ever at a conference and bump into a dbatools contributor, buy 'em a beer. Not emptyquoting. Dbatools is loving awesome.
|
# ¿ Mar 29, 2019 03:11 |
|
Work is willing to pay for some training. Before I started this job (and using powershell every day), I tried working my way through the month of lunches book and never finished. I imagine the right move is for me to start it again and finish it this time, and then look at the toolmaking book too. What do I do after that?
|
# ¿ May 9, 2019 04:54 |
|
AWS Powershell is definitely the bastard offspring. IDK if the rest of the API documentation is as terrible as the Powershell one is, but its frequently wrong. Also much of their getting started documentation says "Here's how to do it in AWS CLI" and then ignores Powershell. Furthermore there's no (official?) API to Powershell lookup table - I've had to click on my best guesses for the cmdlets I want and then read the body text to see what API calls it makes. Also don't get me started on parameters that are documented as optional but are in fact mandatory and only have one allowed value.
|
# ¿ Jul 7, 2019 14:57 |
|
Pile Of Garbage posted:Is there any actual evidence, like testing with Measure-Command, to support this? We used phone timers instead of measure-command, but the end result was that we stopped using += with string arrays at work because of how slow it is.
|
# ¿ Mar 12, 2020 03:53 |
|
I'm not exactly clear on what's failing for you - when I evaluate $computers[0].'Ip address', I find that a null value doesn't return true. Are you looking to evaluate if each CSV line has an IP address, or the CSV as a whole?code:
code:
code:
I don't know how to do #3, and I would be surprised if there was a reasonable way. My solution would be to preprocess the data so that you have an actual CSV instead of a pseudo-CSV with a separator indicator prepended to a proper CSV - which is what you're doing. Happiness Commando fucked around with this message at 02:43 on Dec 22, 2020 |
# ¿ Dec 22, 2020 02:12 |
|
When you put a variable inside double quotes, it expands the variable first, not including the property (basename, in this case). So when you have "$_.basename.aiff" it's outputting the value of $_ and then appending .basename.aiff to the string. If you want to reference object properties in strings, you have to use the "$($variable.property)" interpolation syntax. This should help:code:
Happiness Commando fucked around with this message at 19:55 on Apr 17, 2021 |
# ¿ Apr 17, 2021 19:35 |
|
Exit-PsSession exits out of interactive remote sessions - i.e. the result of Enter-PsSession. It doesn't terminate the session, that's what Remove-PsSession does. But it's not clear to me that open sessions are relevant here, since you're using Invoke-Command on a remote target. I have always assumed that invoke-command run against a remote host (edit: rather than through an open session) terminates its own ephemeral session. How many executions do you get before it starts failing? Edit: This might be informative code:
code:
code:
Happiness Commando fucked around with this message at 19:50 on Nov 25, 2021 |
# ¿ Nov 25, 2021 19:28 |
|
Have you confirmed that the necessary services on both target and source computers are still up even when it fails (i.e. whatever WinRM services, SQL services, whatever) or looked for interesting time correlated events in the event logs? 5 executions is weird AF, and even if remote Powershell happened over RPC, you wouldn't expect your RPC range to only be 5 ports wide. Take a packet capture. Bonus points if you can get the capture of the nth execution that fails for the first time and the n-1th execution that immediately precedes the failure. I'm very curious to find out what the resolution is,.
|
# ¿ Nov 27, 2021 19:27 |
|
Those are the worst/best problem resolutions
|
# ¿ Dec 16, 2021 03:26 |
|
Sounds like you want to do SQL join-like operation:code:
Edit: Oh, hmm, IDK how this pattern would work if you have to look at owner1 or owner2. What about something like this? First you populate your variables, or in the case of the output hashtable, initialize it and leave it empty. Then iterate through all the lines of the users file. For each row of the users file, iterate through all the lines of the shared drives file. If the username matches either of the owners, store it in a temp variable and then write it to the output hashtable. When you've gone through every line, dump the output to a csv. This is super hacky (using the % alias of Foreach-Object is bad practice, using Foreach-Object isn't performant, there's probably a more elegant way) but I think it will work as described. code:
Import the .xlsx files so you can do stuff with them Match the username with the owner field Dump the output somewhere and "Match the username with the owner field" is approached as Store the username somewhere Compare the username to each of the owner fields If it matches, add it to my list to output at the end If it doesn't match, keep looking Happiness Commando fucked around with this message at 05:31 on Mar 2, 2022 |
# ¿ Mar 1, 2022 22:27 |
|
Ooh that's slick
|
# ¿ Mar 2, 2022 21:28 |
|
incoherent posted:Hey all, trying to write baby first parameter based script and i'm sure I'm in over my head and it's probably the simplest thing to write ever, but i can't link all the parts together. I dont understand what you're asking for when you say "two different variables (which I'm reading should be an "arrays") list to the command i'm running." At the simplest level, you define a parameter with param ($ParamName). So if you want to do -dept "shipping", you would put at the top of your script param ($dept) and then run it as .\myscript.ps1 -dept "shipping". And then inside the script, the variable $dept stores the string "shipping". If you want to get more complicated, you can cast the parameters as types (switch, boolean, whatever), make them mandatory or not, set an order, etc. But at their most basic, you just throw them in a variable and call the script using that variable as a flag. Happiness Commando fucked around with this message at 19:28 on Mar 11, 2022 |
# ¿ Mar 11, 2022 18:55 |
|
klosterdev posted:Newbie Powershell question, I'm trying to figure out how to powershell forcing a password reset on next login to specific users in Azure AD, but it looks like the only way to do so it by specifying object ID, and I'd like to do it by selecting userprincipalname. How do I combine Without knowing the behavior of those particular cmdlets, you may be able to just pipe the one to the other. Powershell is frequently good about inferring the way objects fit together. And sometimes infuriating bad. code:
|
# ¿ Apr 6, 2022 00:04 |
|
Sure. Use task scheduler to run a powershell script that does those 7 commands. But why can't you just mount those network locations natively?
|
# ¿ Jun 13, 2023 03:58 |
|
Does anyone happen to have an AWS sigv4 signing script to share, or can point out what's wrong here? I need to calculate some credential from some other credential, which involves hashing a bunch of concatenated strings and storing them in byte arrays (I think?). The python code example from documentation works perfectly. The powershell copypasta from the internet ends up with a different final value (is broken) , but it looks like it's accomplishing the same thing. Printing diagnostics mid calculation doesn't help because the HMAC function operates on byte arrays and they are displayed very differently. They're both using utf-8, so I don't think it has to do with string encoding. Python from https://docs.aws.amazon.com/ses/latest/dg/smtp-credentials.html works perfectly Python code:
Powershell copypasta from https://gist.github.com/jacqueskang/96c444ee01e6a4b37300aa49e8097513 provides a credential, the code doesn't error out, but it doesn't work and is different from the python code:
Edit: Wait, using "foo" as my key and us-east-1 as my region results in both outputs being the same. OK I guess I'm going to rubber duck phone post in the edits BPtBXSjHoMVKYLkS05QmpTxdAWirYy2yB4VgpkK4IhqP Happiness Commando fucked around with this message at 16:00 on Feb 13, 2024 |
# ¿ Feb 13, 2024 15:31 |
|
|
# ¿ Apr 29, 2024 04:29 |
|
Are you capturing the output of that script, or just that you ran the script? If the script outputs something, just set a variable to be the called script like so (the script just does get-date) code:
code:
Happiness Commando fucked around with this message at 21:07 on Apr 15, 2024 |
# ¿ Apr 15, 2024 20:58 |