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

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
0answers
24 views

Powershell script to find and replace words based on asset tag input

Can someone please help me modify this script to generate and modify the document faster? It currently takes about 5-10 seconds to create the variables. About 10 seconds for the entire script to run. ...
1
vote
0answers
63 views

Create a csv of file attributes recursively from a directory parameter in PowerShell

I'm a bit new to PowerShell (version 5) and was wondering if there are any improvements I could make to the following script. Any suggestions for style, code, etc. are all welcome. I'm not sure if ...
-1
votes
1answer
50 views

Huge performance difference: PowerShell Core vs. 5.1 [closed]

Recently I have answered another question about performance. A solution found using PowerShell-ISE successfully, and good speed testified using PowerShell Core. However, running the same script(s) in ...
1
vote
1answer
51 views

PowerShell - Loop Through Nested Objects

I'm writing a PowerShell script to loop through an organization's PowerBI workspaces and spit out the report IDs, names, and URLs for each workspace - so, a nested loop. Here's my working script thus ...
3
votes
0answers
56 views

Sorted LinkedList

A linked list is a data structure that has a beginning, and an end. The only way through the structure is to go to the "next step", like stepping stones. This linked list works the same way, but in ...
2
votes
1answer
24 views

Removing duplicate audio files with different UTC timestamps in filenames, using PowerShell 5

I have a drive with many thousands of sound effects. The files have been stored on different operating systems and NAS devices over time and there are now duplicates of many files, but the filenames ...
1
vote
1answer
50 views

Combine Medical Response Files Prior To Table Load

This is a script I wrote to: Combine multiple text files into one CSV Append the source file's name to each line of data This script currently takes about 3 seconds per 10,000 lines read - this is ...
1
vote
0answers
39 views

ASCII-Box PowerShell menu

I've written a pair of functions that can be added to a module or script that will allow the developer to specify a list of options and let the user select with the up/down arrow and return any ...
2
votes
1answer
31 views

Powershell script to save user credentials in a xml file

I have a power shell script that when run will prompt the user to: Select a folder location select a file name enter credentials This then exports those credentials in a xml file. Although this ...
1
vote
1answer
84 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
70 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 ...
4
votes
1answer
58 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
30 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
54 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
61 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
24 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
57 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
25 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
65 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
40 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
46 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
37 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
2answers
123 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
55 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
36 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 ...
2
votes
1answer
35 views

Powershell script to remove old student accounts from ActiveDirectory

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 ...
3
votes
1answer
164 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
70 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
89 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
44 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
314 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
102 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
292 views
3
votes
1answer
62 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 ...
2
votes
1answer
118 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
92 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
123 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
42 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
133 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
85 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
420 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
61 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 ...