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.

Filter by
Sorted by
Tagged with
-2
votes
0answers
20 views

Modifying to Get-MyBios [on hold]

Trying to remove the begin and end statements to modify the script to Get-MyBios on PowerShell ISE and I don't know where to remove from this code: ...
2
votes
1answer
39 views

Powershell script to stop and start services on demand

The purpose of below code is to stop/start a couple of windows services if they are running/not running, this will be called from a windows command line. The services could be either on a windows ...
4
votes
1answer
30 views

How could I have made this Powershell script that executes robocopy code better

I am trying to get better at Powershell and was wondering if I could get some advice on how to make this code more efficient/cleaner/anything. This code is intended to launch three batch windows ...
3
votes
0answers
44 views

Script to backup data to specific USB Drive

I have a script and I was looking to have it reviewed to see where I should improve it. Our need: We need to backup a folder every day to a specific USB drive. There may be multiple USB drives ...
1
vote
0answers
37 views

Add and toggle firewall rule and change DNS settings

I have been working on writing a script that will allow me (and my wife, as you'll see in some of the text in the code) to switch countries for some streaming services I use. It first checks to see ...
1
vote
1answer
39 views

Script to Backup Data to Remote Location. The data to backup depends on the day of the week

I have a script that I wrote, and I'm sure that there is a better way to do it, but can't for the life of me figure it out. Here is the problem statement: I need to backup data to a remote location, ...
3
votes
1answer
71 views

Powershell - Simplified Logging

Today I have dealt with logging in PowerShell as well as with the different streams and the pipeline. Unfortunately, none of these solutions really met my needs. My requirements are: I need to ...
0
votes
1answer
35 views

Check multiple subdirectories and delete if file exists [closed]

Long story short, I have over 180K files that I need to delete. I have all of the file names that need to be deleted in a TXT file, however the files that need deleting are scattered in over 400 ...
2
votes
1answer
34 views

Creating a file of md5 hashes for all files in a directory in PowerShell

I have been trying to write the md5 hashes for all files in a directory and its subdirectories to a file. Ideally, replicating the output of the Unix command ...
1
vote
0answers
65 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
1answer
264 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. The script creates ...
-1
votes
1answer
61 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
125 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
69 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
26 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
54 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
71 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
45 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
88 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
101 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
73 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
34 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
63 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
70 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
34 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
119 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
27 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
26 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
121 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
34 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
49 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
41 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
147 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
67 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
43 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
41 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
201 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
53 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
76 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
106 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 ...
2
votes
1answer
51 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
445 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
199 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
365 views

PowerShell - Execute Windows Task Scheduler

...
3
votes
1answer
65 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
133 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
100 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 ...