#powershell
Explore tagged Tumblr posts
gordon-pint · 3 months ago
Text
I've been struggling for *days* to learn the syntax of some code at work to fix a massive problem involving 9 million address records, and shot in the dark I was like there's gotta be a PowerShell developer in the Chicago Competitive MTG discord server. And sure enough I got a bite and my whole week has been saved by a Lemur named Daryl
106 notes · View notes
r8kirani · 1 year ago
Text
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
look at my objects boy
90 notes · View notes
revermbed · 10 months ago
Text
Just spend about like 4 hours learning powershell just so that i can semi-automate installing like 6 apps via powershell
Tumblr media
His name is pissy and i love him.
52 notes · View notes
la-principessa-nuova · 9 months ago
Text
I spent so long today trying to figure out why .gitignore wasn’t working.
I spent *hours* going through so many StackOverflow questions and reddit posts where brand new developers are trying to use a .gitignore for the first time and getting the syntax wrong or putting it in the wrong directory or naming the file wrong or they already tracked the files. All common mistakes I made when I was new to this, but not what was wrong for me.
I’m suddenly reminded what it was like back then everytime I had a problem googling every little issue and thinking some obscure issue was happening or there was a bug in git or something, and then I’d find the small error I’d made. But now I understand it so well I’m stumped what could be wrong.
Flashback to when I was trying to decide which OS to use when writing it and decided it was simple enough that Windows would be fine. Plus I want this to be cross platform and so it’ll be good to be forced to deal with Windows compatibility up front.
Then finally I found the issue: I created the .gitignore from Powershell and it defaults the encoding to UTF-16LE??? Why would they do that? Just to prank people trying to create files to be used literally anywhere???
Changed it to UTF-8 and it works.
god
18 notes · View notes
zeldurz-art · 7 months ago
Text
Tumblr media
Y’all ever make up a bunch of copy-paste men for the hell of it (profiles under the cut)
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
8 notes · View notes
mirqmarq428 · 2 years ago
Text
Powershell syntax is not confusing
(you are just confused because posix compliant shells have corrupted your mind)
> do-action -param "string" $variable (do this first) [type]value
To declare a function:
function do-mythings {
param([int]$argument)
$argument + 5
}
> do-mythings -arg 5
10
That's all you need to get started.
Numbers are just numbers.
Inline math just works. Parentheses for order of operations.
Strings you put in quotes - double quotes allow interpolation, single quotes don't. This is the same as sh.
All variables are prefixed with $s. Even when declaring them. This makes slightly more sense than sh.
A region in {squirrelly braces} gets the [scriptblock] data type. It's like a lambda but comprehensible by mere mortals.
if (test) {success} else {fail} - the test is always executed first because (). Success and fail conditions only depending on the test. They're script blocks. No weird special syntax, if may as well be a user function.
Functions can be named anything, but the convention is Verb-PlaceThing. Not case sensitive.
Named arguments are specified with a single hyphen, like MIT Unix software (xorg for instance). If there is only one parameter the name is optional, etc. Param names can be abbreviated as long as they aren't ambiguous. This is also easy to follow with your own functions, unlike in sh (fricking hate getopt).
Types are inferred dynamically because it's easier to write scripts that way. If you need to force something (variable, expression, whatever) to have a specific type, put it in [brackets] beforehand. The type names are the same as c# and every other post-algol language. For comparison, posix shell only has one type, String.
To make an array, @(item1, item2, etc)
To make a hashtable, @{
key1 = val1
key2 = val2
}
Adding strings concatenates them together. Adding numbers adds their values. If this is not satisfactory, declare their types and it will work.
All expressions are technically objects with properties and methods. $var.property returns the value of that property. $var.invokeMethod() runs the method, which is just a function built into that data type by some poor intern 20 years ago.
Pipes (|) work similarly to sh, but transfer objects. The current object in the pipeline is always the variable $_.
As a bonus, here's a one-liner for opening Internet Explorer on Windows 11 (they lied, it's still there, they will never remove it)
(new-object -com "InternetExplorer.application").visible = $true
COM is an old windows api. Com Objects are just instances of apps. We open internet explorer as a com object.
The parentheses sets that as an expression, and its return value _is_ the exploder. It has properties like visibility, which is $false by default. This is boring so set it to $true. Now we have a real working instance of an app they've been trying to remove for years, because they can't actually remove it merely hide it away. As long as the windows api can parse HTML, this will still work.
70 notes · View notes
localowlhousefanatic · 2 months ago
Text
She Powers on my Shell til I windows
3 notes · View notes
phrear · 11 months ago
Text
forgot what powershell was called for a moment and ended up with this fucking thing
Tumblr media
4 notes · View notes
ajguides · 1 year ago
Text
How to Reset Windows Update Group Policy Settings
Tumblr media
How to Reset Windows Update Group Policy Settings | https://tinyurl.com/27evw79k | #GroupPolicy #Guides #Microsoft #Windows #WindowsUpdate #WSUS If you’re transitioning away from Windows Server Update Services (WSUS) or need to troubleshoot Windows Update issues, resetting the Windows Update Group Policy Object (GPO) settings can be essential. Often, corruption in registry permissions can prevent expected changes from taking effect. This guide will walk you through the process of resetting these settings by removing the specific registry key responsible for Windows Update policies. Steps to Reset Windows Update GPO Settings Why Reset Windows Update GPO Settings? Resetting the Windows Update GPO settings is crucial when: Prerequisites Step-by-Step Guide 1. Open PowerShell with Administrative Privileges To reset the Windows Update […] Read more... https://tinyurl.com/27evw79k
2 notes · View notes
thepillarsofmarsandvenus · 1 year ago
Text
Tumblr media
Why Did Microsoft Make PowerShell Hot and Evil?!?!?
2 notes · View notes
vidadelafuerza · 1 year ago
Text
JavaScript Node.js PowerShell JSON Repeat
Lately, I've taken a lot of time to reacquaint myself with JavaScript usage in Node.js. Specifically, I'm learning all the basic things I enjoy doing in PowerShell: File manipulation (list, read, write) and data manipulation (parse, extract, interpret, summarize).
Specifically, my favorite thing is to see something of interest on a website and/or analyze a website's requests in the Network tab of DevTools (CTRL+SHIFT+I). It has to be something useful. Such things can be scraped for data I might want. The way I do that is in the Network tab of DevTools (Chrome, MS Edge). Looking at a request, I can right click and get the PowerShell (or other code) that would give me that exact same information in Windows Terminal. Then, I typically do an ad-hoc script to get what I want.
Current Web Scrape++ Project
The project that has my interest at the moment is one where I'm taking all the text of a copyrighted version of the Bible, then using DOM queries and JavaScript to get just the verse numbers and verse text per chapter from the HTML. It sounds as complicated as it is, but it's the kind of thing I do for fun.
Node.js comes into play when I want to loop through all the HTML I've pulled and sanitized. The sanitization wasn't easy. I kept only the HTML with actual Bible text - which reduced the HTML payload to less than 2% its original size. That part was in PowerShell and Visual Studio Code. But I digress.
Using the Console of DevTools, I already have the JavaScript I'll need to pull what I want from the HTML file data into an array of "verse" objects, which I can then easily translate to JSON and write out.
Next, my goal is to take the data, store it as JSON files, and then manipulate it with PowerShell. For instance, I wonder what it looks like if I replace the word "Lord" with "Earl" or "Duke". As silly as that sounds, that's the entire modus operandi for my project, which has been maybe as much as 6 to 8 hours. The rest probably won't take that long, but each step has to be pursued with the smallest steps I can think to make. (There's no use looping 1189 chapters / files of HTML text to get erroneous stuff, so I go small and then large.)
2 notes · View notes
seniordba · 2 years ago
Text
Disabling or Uninstalling Unnecessary Services and Apps in Windows 10
Windows 10 is a powerful and versatile operating system that offers many features and functionalities. However, not all of them are necessary or useful for every user. In fact, some of the services and apps that come preinstalled or run in the background can pose security risks or slow down your system performance. In this blog post, we will describe which unnecessary services and apps you should…
Tumblr media
View On WordPress
2 notes · View notes
techworkdk · 2 years ago
Text
2 notes · View notes
greenoperator · 2 years ago
Text
* vs % wild-cards!
When working with databases, each technology has its own designated character that can be used as a wildcard character. Usually these characters are * and %.
Recently, I was stuck for several hours on a problem which was related to wildcards. Let me set the scene. I was using a Microsoft Access database with data that had to be queried via PowerShell. The problem I encountered was that the wildcard character for SQL queries in Microsoft Access use “*”, but when the query was being sent from PowerShell, the result from the $cmd.ExecuteReader() command was blank. 
Ultimately, I discovered that with PowerShell, you cannot use “*” for the wildcard, it won’t pass through PowerShell to the Access database. Once I updated the query to use “%”, everything worked correctly!
3 notes · View notes
heliomsj · 2 days ago
Text
Tumblr media
Notepad++ Edição de arquivo
0 notes
mirqmarq428 · 1 year ago
Text
Trying to write a setup script for Windows and still appalled that they don't allow users to make symlinks by default.
In the morning perhaps I'll find a way to enable it from within admin powershell...
3 notes · View notes