Stack Exchange Network

Stack Exchange network consists of 174 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
11 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
18 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
28 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
37 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
40 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
33 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
59 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
41 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
29 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
26 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
104 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
49 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
54 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
70 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
118 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
46 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
183 views
3
votes
1answer
60 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
75 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
88 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 ...
0
votes
0answers
21 views

Get a users nested group memberships w/o AD cmdlets

So we have this customer that has a hybrid AD environment. They still have all their data on traditional network shares. But they are also moving all their users to AzureAD. Since the customer doesn'...
1
vote
2answers
72 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
51 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
35 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
126 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
82 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
64 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
302 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
54 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
1k 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
41 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
620 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
45 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
793 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
195 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
178 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
40 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 ...
2
votes
1answer
249 views

Replicate / Sync files from source to destination with powershell only

I have lots of live and disaster recovery servers, which should have the same files and folders. I searched on the web but could not find a Powershell script which has all of the functionality on the ...
1
vote
0answers
40 views

Update Distribution Groups

I have put together a script that will serve as a tool for a Power User so that they can make changes to two distribution groups in our organization that are used for "on call" purposes. It works as ...
4
votes
1answer
96 views

Reading event logs of several computers

This is my first PowerShell script. It reads the event logs of several computers in the local network and lists error/warning messages written to them in the last 24 hours, if any. I'll appreciate ...
3
votes
2answers
270 views

Arp-spoof check in PowerShell

To learn some PowerShell I made a tool, I've made before in bash. It pings the subnet for arp values and checks if there is no weird behaviour. ...
0
votes
1answer
45 views

Construct URLs out of filenames of zero-byte images and open them in Firefox for re-downloading

It's a problem with FlashGot: it sometimes download zero-byte files. I think it's because I didn't use something like DownThemAll! to limit the number of concurrent downloads, but I wrote this script ...
0
votes
1answer
124 views

Powershell GetKeystate with outfile

I got a keylogger Powershell script to protocol my input, since I'm quite paranoid if someone uses my PC. However, some letters (I have an anti-ghosting keyboard) are swallowed if I type them in fast....
1
vote
0answers
31 views

Ensure temporary directory is cleaned up after use

Often when using temporary folders you need to think about cleaning them up afterwards. My idea is to make use of the pipeline processing order to have the command which creates the directory also ...