Quantcast
Channel: /r/powershell – How to Code .NET
Browsing all 8793 articles
Browse latest View live

Does win32_process allow to query for “status” of said processes? Seems to be...

I am using the following code to respond back with list of processes of a remote server: processes = Get-WmiObject -Class win32_process -Namespace "rootcimv2" -ComputerName $hostname | Select name,...

View Article


Add-Content while the file is being tailed

Hey everyone, I just ran into an issue at work where a powershell script was failing to write to our log file. We’re using an enterprise log monitoring utility (Splunk), which tails files and monitors...

View Article


How to manage Windows File Shares with PowerShell

submitted by /u/Net-Runner [link] [comments] The post How to manage Windows File Shares with PowerShell appeared first on How to Code .NET.

View Article

How do you keep your profiles/etc synched between your machines?

I’ve seen a lot of people do things with Dropbox or OneDrive, but I’m trying to incorporate my work machines also. On my laptop, I could easily do something like Dropbox, but I also use a few ‘admin’...

View Article

Replace with a variable inside String Replacement template

$file = "[assembly: AssemblyVersion(""2.13.0.0"")]" $build_number = 78 $new_file = $file -replace '([assembly: AssemblyVersion(")([0-9]+.[0-9]+.)([0-9]+)(.[0-9]+")])', "`$1`$2" + $build_number + "`$4"...

View Article


Do-until Loop

So this should be an easy task in theory, but for the life of me I can’t seem to figure it out. Goal is to stop after a number of matches are found and end out of a loop. Here is a snippet with...

View Article

Issue logging into site with no form ID

Hi all, I am trying to automate the login of a site so I can grab a link. I’m having issues because the “login form” doesn’t use ID’s and is also present 3 in the page. I think the latter shouldn’t...

View Article

Compare-item gets stuck

Im trying to compare 2 drives of files, with compare-item but its never completes. I dont know if it because there is around 70.000 files pr drive, and its too much. Is there any other way to compare...

View Article


Multiple Directory Check if notexist then run x

I have created the following script. I need to validate that none of the folders exist and if they do install something. To test that it runs i have put a txt document on my c drive as reference. When...

View Article


How do I start learning PowerShell?

I browsed through the top posts and sidebar and couldn’t find an up to date resource on PowerShell. I want to quickly learn basic automation and have some experience in programming languages like C...

View Article

cannot run the following modules are missing

Hey guys, I’ve got a server that seems to have gone… loopy. I can’t suggest anything that has changed about its configuration as I can’t quite remember the last time I used the scripts on the server....

View Article

WMI intercept system shutdown

I would like to run a particular script before system shutdown. When I trigger a shutdown event, my script doesn’t appear to get called. Here is my setup, what am I doing wrong? $scriptFileName =...

View Article

PowerShell Modules & Frameworks sticky

Hi all! I’ve occasionally looked for popular PowerShell modules over time and always seem to return to this post from /u/replicaJunction. That post is very informative but perhaps a bit dated now...

View Article


Troubleshooting Failure to Rearm Office @ Startup

One of the facets of my job includes configuration of training VM loads to exacting standards. Among these standards is for an existing installation of Microsoft Office to be rearmed (not activated)...

View Article

extractifyr: Scan for zip archives (regardless of file extension) and...

Hey, everyone! I’m quite new to PowerShell, but wanted to share a new script I’m working on. I’ve been reverse engineering video games for years, but have recently wanted to start creating my own...

View Article


Looping through the output for get-adcomputer

What I am trying to do. $list = Get-ADComputer -Filter ‘WhenCreated -ge $recently’ -Properties whenCreated | Format-Table Name -Autosize -Wrap for i in $list { # do something with $i } how do I do...

View Article

[Question] working with outdated PowerShell

At my work computers are running PowerShell 2 which is unable to run my script written in PowerShell 5. I asked IT about it but since I’m working for a big international company they’re very slow to...

View Article


$env:os and win32_operatingsystem reporting two different OS?

Hi everyone, When I run $env:os, it tells me my machine’s OS is Windows NT. When I run Get-WMIObject Win32_OperatingSystem| select-object Caption, it tells me my machine’s OS is Windows 10. I know for...

View Article

Possible to override application window title?

I need to override – or even preface – the application window title for Google Chrome to something specific that will persist throughout the user session. Is this possible via PowerShell (or by any...

View Article

VBScript to Powershell

So there are a few scripts, okay may be more like 20 that we have written in VBS. There are a few scripts that will need to be re-written and moved to Powershell. Some sooner than later....

View Article
Browsing all 8793 articles
Browse latest View live