Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [powershell]

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and CIM enabling management of remote Linux systems and network devices.

1
vote
1answer
70 views

Joining and resolving two paths while keeping them relative conditionally

I would like to have a function Chain-Paths to accomplish the following: given a base directory (Base) and a location, possibly ...
4
votes
2answers
49 views

Determine the third octet of an IP address based on user entered site number

I am trying to create a function for a larger script to determine the third octet of a site IP address based off a user entered site number. I have actually come up with the function, but was hoping ...
3
votes
0answers
29 views

Powershell script for zipping up old files

I have a script for zipping up old files. I know using Windows Compression isn't ideal, so I will make the script run using 7-Zip later on. For now though, I just want see how I can make my current ...
1
vote
0answers
26 views

PowerShell script to build and pacakge Go application for release

Background I decided to write build script as a gentle introduction to PowerShell. It builds and packages this Go application, which is an internal tool I decided to open source, and not the focus of ...
0
votes
2answers
48 views

Search files content fast in powershell

I need to search a large repository of files for a specific resource, and return it only if it is used or not. It is working as expected, but it is very time consuming. To search for 50 resource ...
1
vote
1answer
57 views

ImportExcel for Dataset with Multiple tables

I need to be able to create an Excel document with multiple tabs for a dataset with multiple results\data tables. I have a stored procedure with 3 selects in them, fairly simple ones pulling data from ...
1
vote
0answers
22 views

Uninstalling Erlang and RabbitMQ, using Write-Verbose to ensure sequencing

I'm new at PowerShell and I like it. I had the change to write a script that uninstall Erlang and RabbitMQ and I want the same script to then remove the Erlang folder and the RabbitMQ folder. But ...
1
vote
0answers
29 views

Basic Kibana/Elasticsearch Search - Powershell

I am traditionally a Java/Backend Developer, and have recently been spending a lot of time dealing with issues that higher tiers of support should be able to handle themselves. To assist them with ...
1
vote
0answers
23 views

Using Powershell to automate creating company directory and renaming cover letter and resume

I'm in the middle of job searching and while doing so, I have to create a folder for the company and position, then move my base cover letter and resume to that folder and begin customizing the ...
0
votes
2answers
24 views

Bulkloading xml's into Oracle table

Intro We have some old(in my eyes) software at the place I work at the moment, Some stuff needs to be done manually, for instance we need to insert a XML file into a Oracle table, which will trigger....
0
votes
0answers
37 views

Use PowerShell to create hyperlinks in Excel to local images

I'm rather new to PowerShell so I could use some help with why my script is running so slow. It starts off just fine, and even the first 30 or so iterations of the for loop are zippy. But by the time ...
1
vote
1answer
33 views

Gather list of all IDs ordered by submission date and ID by parsing file path

This code is to gather a sorted list of IDs (first by ID, then by date) recursively from a directory that submitted a particular type of file (that, as you can tell, includes the word "Magic") and ...
2
votes
1answer
38 views

Finding a string in a text file and reporting full file name and size

I have the following script to find files containing a certain string and then report on the location of the file along with the size in bytes. It works, but I seem to have made heavy weather of ...
1
vote
0answers
43 views

Jenkins Powershell script to copy code from Github to AWS Lambda

This is a <10 line Jenkins powershell build step triggered by a git commit which zips code and copies to lambda. Seems to work fine for javascript projects. I check for the zip file and then remove ...
0
votes
1answer
34 views

Quickly check whether file name is in column in an SQL Table and move to new folder

I have a table that in one of the columns exists a list of file names. The names comes from other tables and the files in a folder. Not all the files are used, may be attached to parcels that no ...
4
votes
1answer
76 views

Euler Problem 7 (finding the 10001st prime) in Powershell

I am having issue making this code more efficient. The problem to be solved is as follows: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. ...
3
votes
0answers
50 views

Morse Code Blinking through Caps Lock in PowerShell

I'm new to writing PowerShell scripts, and this would be my first relatively large undertaking in the language. Any feedback regarding style and readability would be greatly appreciated. Particularly, ...
1
vote
0answers
32 views

Leavers Script to disable users in AD, Remove Groups, delete profile and move home folders

i am pretty new to powershell and im not great at coding, but i have managed to cobble together code from around the net to help save time when removing old students accounts in AD. Code currently ...
0
votes
1answer
29 views

Powershell Newcomer, Help to tidy up this code

I am pretty new to powershell and I'm not great at coding, but I have managed to cobble together code from around the net to help save time when removing old students accounts in AD. Code currently ...
1
vote
1answer
121 views

Inserting data into SQL-Server table dynamically

I know I can do all this via SSMA quite quickly, but I wanted to see if I could do it efficiently in PowerShell myself as a little project. Basically, the entire script takes tables from an Access ...
1
vote
1answer
51 views

Text extraction of document files

I have this script that pulls text out of .docx, .doc and .pdf files and uploads that text to an Azure SQL Server. This is so users can search on the contents of those documents without using Windows ...
2
votes
0answers
61 views

GUI and Powershell script to manage mail accounts [closed]

I've written this rather cumbersome PowerShell script that facilitates a business use case. Because I built it off a PowerShell auditing tool I made, it was formatted differently. What I'd like to do,...
0
votes
1answer
80 views

Sorting CSV table in Powershell

I'm wondering if some PS gurus can advise on whether my method for sorting and recombining some data fields by using an array of PSCustomObjects is as efficient as it might be. I'm importing a CSV ...
1
vote
1answer
40 views

Powershell for syncing Minecraft save files

My code in full plus the task scheduler definition: https://gist.github.com/DaneWeber/0c5e7978bd3927734173e3afdc3d6338 This is my first non-trivial PowerShell script. This was a pretty major learning ...
2
votes
2answers
193 views

Powershell script that updates Active Directory user information

I wrote this Powershell script years ago for updating AD from a CSV file. I'd like to try to optimize to run quicker and be more efficient... but I'm not sure where to start / what could improve it. ...
3
votes
1answer
65 views

Backup Windows user's profile

I do a lot of PC swaps/replacements for my role. I've decided to write a script to assist with backing up the user's profile and network drives. I'd like to see how my script stands now. I'm still ...
1
vote
1answer
244 views
3
votes
1answer
61 views

Get owner of ~5 million files and folders using Powershell and Robocopy

I've written a Powershell script that uses Robocopy to get the full path of all files on a drive and then run it through a foreach loop to get the owner for each file and generate it in a CSV. The ...
2
votes
1answer
19 views

Restarts specific services across 8 servers

I created this script to stop and then start specific services across an environment of 8 servers. The server names are Apollo-1 thru Apollo-8. I'm looking for suggested changes to make sure my ...
1
vote
1answer
91 views

PowerShell Script to deploy repository to Salesforce

I've made a useful PowerShell script to automate our code deployments to Salesforce. After a couple of afternoons learning PS and some try/error, I finished my script and it's working. Nonetheless, ...
4
votes
1answer
90 views

Rename jpg images using a script

I like to collect images for my desktop background, the problem is sometimes the image names don't represent what the image is. I decided to write a script that reads a text file that contains the ...
1
vote
2answers
74 views

Powershell function to search CSV logs for certain regexes

I have a parser that goes through two different logs, both .csv files, and checks for certain lines based off the regex code that I have chosen. This parser works fine, it just takes about a minute ...
4
votes
0answers
83 views

See the Progress of the Powershell Jobs you are running

This code allows you monitor the progress of the Powershell Jobs you just started. One of the key features is the ability to stop the other Jobs when 1 is failed. For example, if you are running some ...
4
votes
0answers
38 views

Class based Kjijii Webscraper

Using PowerShell I have made a class based Kijiji webscraper that records progress in a MariaDB table (for use in another project). I had made this as a module with cmdlets months ago but I wanted to ...
6
votes
0answers
130 views

Advanced Logging Function

Way more blood, sweat, and tears have went into this then I would care to admit, but this has been a function I have been using in some shape or form for quite a while and it has taught me alot. It ...
3
votes
2answers
83 views

Replacing values in a list

This is my first Powershell script ever so bear with me. I'm trying to replace values in a sharepoint list from a CSV file: ...
0
votes
1answer
65 views

Clearing files from directories

My code does what I want, which is remove any files from these specific folders. Is there a smoother way to do this? ...
5
votes
1answer
363 views

Create release package from git tag with Powershell

In my deployment I need to generate a zip file from a git repo. I have the basic work done with how to pull the latest tag and create the zip file. I ended wanting to update the files that are pulled ...
3
votes
1answer
56 views

Using PowerShell to deploy a staging environment to production

So it's been a while. I present you with a somewhat basic PowerShell script that is designed to deploy our staging environment to production, on a nightly basis. I've designed this to be robust, and ...
0
votes
1answer
2k views

Powershell Script to remove printers and drivers

I am learning Powershell Scripting as I move my work environment to Windows 10. The script below is to be edited by the SysAdmin (for the list of Print Queues and Printer Drivers) to specify what ...
4
votes
1answer
44 views

Query registry for installed software

Hoping someone can help me out with the two aspects of my script that I think is causing the most performance hindrance. Recreating the Array $Result and using the <...
1
vote
1answer
52 views

Finding terminal server user is connected on

I'm trying to find out which terminal server a user is connected to. Currently I'm trying to cycle through each server and check if he is connected. ...
10
votes
1answer
775 views

Using build event to run Powershell script to run built DLL

As a rule, whenever I find myself doing something that nobody else is doing, I have to be quite suspicious about what I'm doing. This is why I want to get code review to verify I'm not doing something ...
2
votes
1answer
46 views

Consolidate multiple very large medical claim response text files for database load

Each month we receive 30 text files containing various medical claim responses. We sort these into three subfolders and then consolidate and load them into a database table for analysis. This may not ...
1
vote
1answer
59 views

Generating a warning when I/O size limit is exceeded

A function is doing IO operation . If the IO reaches a size more than warning limit storage array will send the event to host. The same function will fetch the event. I have used the verb-noun ...
0
votes
1answer
972 views

Invoke-WebRequest in a loop until NotFound

I'm using SAP's Raylight RESTful SDK to get a list of universes from the BusinessObject Enterprise repository. To get all of the universes, the request needs to be called repeatedly, incrementing the ...
1
vote
1answer
242 views

Comparing dates with SharePoint PnP PowerShell

I am wondering if should change my if statement that compares two dates if they are equal. Is there a better way of doing this operation? The code does what it supposed to do. No errors. The Code: <...
3
votes
1answer
209 views

Work with configuration files holding encrypted credentials

The idea with this script is to provide a way to work with configuration (xml) files for PowerShell scripts. These files may contain credential information which needs to be secured; those would be ...
1
vote
1answer
43 views

Powershell remote script execution pattern

On a CredSSP enabled server is a .psm1 script file that gets executed remotely from a client technology. The client passes in a couple execution parameters and the server script returns an object ...