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
-1 votes
1 answer
31 views

Is there a better way of creating this small guessing game in PowerShell? [closed]

I have a guessing game in PowerShell trying to practice the while statement. I found this on the internet on someone's repo. I have a feeling it can be shortened but maybe I am wrong. This is pure for ...
user avatar
  • 15
0 votes
0 answers
12 views

Powershell Function for Assigning users to particular group based on selection

I'm fairly new to Powershell. I'm trying to create some basic functions of the task I do at work. We have 5-6 AD groups that we have to add users on daily basis. I thought I automate that process as a ...
user avatar
0 votes
0 answers
22 views

Menu for weekly tasks

Hello I have frankensteined a menu script that allows for me to do variety of things I do weekly as IT support but had issues with the force reboots and not sure if possible to add a copy remotely a,b,...
user avatar
0 votes
0 answers
19 views

Array of values determine if they vary wildly (or not) using z-score

Determine how 'spikey' graph data would be I want calculate if a list of random set of unsorted numbers present themselves as varying greatly over the one value to the next. The thought is to be able ...
user avatar
  • 113
2 votes
1 answer
66 views

Any issue with this as a password generator?

Was trying to create a password generator like the one Bitwarden has... Curious if anyone sees any issues with this? (wordlist shortened for readability) There perhaps there's a more efficient way I'...
user avatar
0 votes
0 answers
21 views

PowerShell to query SQL database with a string from a filename

I am trying to write a PowerShell script that will check a folder for any files and then for every file it will grab part of the filename and check it against the SQL database. If it found a match, it ...
user avatar
  • 1
1 vote
0 answers
51 views

Veeam automation backup script in Powershell

I created a simple script to monitor the backup process for veeam, script accept only drives that should be on current days (to avoid override of data), monitor 2 backup jobs. Definitely could be done ...
user avatar
0 votes
1 answer
33 views

PowerShell function for provisioning a new Active Directory user

I created a function for creating a new user in AD, assigning an o360 license and enabling mailbox, however, my code is very chaotic and I do not have a much experience with PowerShell. Could you ...
user avatar
4 votes
0 answers
164 views

Tree for PowerShell

This Module started as a fun coding exercise designed to emulate the tree command and also calculate the size of each folder based of the files size of that folder (...
user avatar
1 vote
1 answer
50 views

Powershell script to check for processes on remote systems and rename/copy files

Processing a set of conditions with 'Continue' I found the following more readable, opposed to trying to parse out if/elseif. What are your thoughts about this? Is there a better way? What The Code ...
user avatar
  • 113
3 votes
1 answer
56 views

Conway's Game of Life in Powershell

I'm learning PowerShell for professional development, but decided to do a bit of a silly project to help learn scripting in more depth, and chose Conway's Game of Life. This is the first PowerShell ...
user avatar
1 vote
0 answers
58 views

Batch/Powershell program to retrieve system info

This is my first time coding! My intent for this program was to be able to give my technicians a flash drive that will pull system info and email it to me. Currently everything is working, but I was ...
user avatar
0 votes
1 answer
54 views

powershell script for creating a Domain Controller

I don't have a lot of experience creating/managing an active directory environment. This will be more of a lab environment where a solution could be tested. It will not have lots of regular users etc, ...
user avatar
  • 175
1 vote
1 answer
38 views

Script to copy Egde-Chromium browsing history from a remote machine. Try-catch, custom object building

There are some Kiosk machines for people to take a survey. The survey is running by a 3rd party, so no way to get the data from them. To measure how much machines are in use I wrote a script to pull ...
user avatar
0 votes
0 answers
34 views

Changing password on remote machine. Try-catch, custom object building

This code is for changing local user password on remote machines. According to security passwords of privilege accounts need to change once in a while. Script trying to connect to a machine and trying ...
user avatar
3 votes
1 answer
283 views

PowerShell script binary-decimal-hexadecimal-ipv4 convertor

This is a fully functional PowerShell script I wrote not long ago that converts data (numerical data) among 4 data formats: binary, decimal, hexadecimal and ipv4. It supports 12 conversions, it can ...
user avatar
3 votes
1 answer
65 views

Disk usage reporting script performing poorly with lots of files

I am running a PowerShell script that shows disk usage for drives into HTML reports. While this works quite well it has a problem on some file servers with a massive amount of files. It can sometimes ...
user avatar
1 vote
0 answers
28 views

Powershell Refolder by Filename Before Delim

I'm pretty new to Powershell but have been using it more and more to automate tasks at work. Now I'm reaching out for some help. I typically use the scripts I write in a way where I copy and paste the ...
user avatar
0 votes
1 answer
160 views

Creating a specific distribution of random numbers in Powershell

I originally posted this on StackOverflow but was requested to post it here instead as it relates to optimization/performance of the code rather than a specific problem. TL;DR: Get-Random produces an ...
user avatar
0 votes
1 answer
63 views

Compare hostnames and leases between CSV and DHCP info

I have 3 nested loops and they do the following: Get scopes from DHCP Get hostnames from csv file Compares hostnames and leases, matches are added to a hash table There are 5 DHCP servers, 100's of ...
user avatar
2 votes
0 answers
40 views

Sort items so that parents are created before their children

I've been asked to create some code to help automate the loading of data into a system based on employee data in a spreadsheet. However, the data isn't clean, so some people may have no manager, some ...
user avatar
  • 1,329
2 votes
1 answer
47 views

Powershell SMTP report with attachment issues needs corrections

I created this tiny script to full fill a repeated request from audit. I want to expand it but ran into an issue with file creation. This code will create the ...
user avatar
3 votes
2 answers
926 views

PowerShell script to convert .reg files to PowerShell commands

This is a PowerShell script I wrote a while ago that converts Windows Registry files to PowerShell commands(New-Item, Remove-Item...
user avatar
0 votes
1 answer
36 views

Optimizing PowerShell string hasher method

I am building a PowerShell class based tool that works with XML files of as much as a few hundred Kb size, and as many as a hundred of these files. I have extensive validation code that is time ...
user avatar
1 vote
0 answers
565 views

PowerShell CLI calculator

I found a project that aims to implement a CLI calculator app in as many different languages and ways as possible. Having a little experience in PS, I tried my hand at it. The requirements are as ...
user avatar
1 vote
0 answers
66 views

A big prank using VBScript

So, I have made a BIG prank in VBScript. First part is to prank with a Dummy HTA splash screen using an encoded PNG image inside it (Not included) and kill all windowed processes+explorer and keep it ...
user avatar
1 vote
1 answer
54 views

Powershell duplicate image scanner

So I have made this Duplicate image scanner using powershell. It will operate using the SHA256 hashes of the files. Any tips or suggestions on making this more dynamic/robust/efficient or adding new ...
user avatar
4 votes
1 answer
794 views

PowerShell - fast remove a directory with 10,000+ files

I am sick of File Explorer's super slow deletion speed, so I tried to write a PowerShell script to make deletion faster, and while it does its job, its speed isn't as high as what I intended it to be. ...
user avatar
1 vote
1 answer
70 views

PowerShell - calculate occurences of Friday the 13th between (including) two given years with builtin and without builtin

It's me again, talented programming beginner fast-learner, so I have overcomed yet another self-imposed programming challenge, I have developped two algorithms to calculate occurrences of Friday the ...
user avatar
1 vote
0 answers
266 views

Exporting Shellbags, Jump Lists, and LNK files with PowerShell

I'm new to PowerShell (started yesterday) and was wondering if there is a way of exporting Shell bags, Jump lists, and LNK files from the Reg to a local computer's desktop using PowerShell? I have ...
user avatar
1 vote
0 answers
630 views

PowerShell - Sort strings containing numbers numerically

I am a newbie in programming, but I do have potential, I am using PowerShell to hone my skills, I have written a simple function to sort strings consisted of numbers humanly (i.e. in a order like 1 2 ...
user avatar
1 vote
0 answers
87 views

PowerShell - Convert English words describing numbers to their values in Arabic numeral

I am extremely new to programming, and I am a really fast learner if I am interested, I have only started using PowerShell in less than a month, to improve my programming skill, this is a script I ...
user avatar
1 vote
0 answers
123 views

PowerShell - Find Least Common Multiple of a series of numbers

I am a Windows power user, a system tweaker, my idol is Leanardo da Vinci, and now I want to be a hacker. I am extremely new to programming, but I really am a fast learner if I am interested in the ...
user avatar
1 vote
0 answers
214 views

PowerShell - Calculating date difference between two given dates in days without builtin and with builtin

The title says it all, I have written two scripts to calculate dates to test my abilities in programming, one from scratch, without [DateTime], New-TimeSpan and even [math]::Ceiling, and it's really ...
user avatar
1 vote
0 answers
55 views

Remote computer file transfer with PowerShell script

Remote-Computer-File-Transfer I have created a PowerShell script, , for remote computers file transfer, for computers that only support New-PSDrive cmdlet, and I ...
user avatar
1 vote
1 answer
125 views

"Backwards Read Primes" of Codewars powershell version

Link to problem: https://www.codewars.com/kata/5539fecef69c483c5a000015/train/powershell I have a working solution in Codewars but my solution is slow for some reason and I need to improve the ...
user avatar
1 vote
0 answers
35 views

Weekly Employee Report Generator PowerShell Script

Weekly Employee Report Generator PowerShell Script Description This script is used for generating a Markdown template file for weekly employee reports. In ...
user avatar
1 vote
0 answers
40 views

File Removal PowerShell Script

File Removal PowerShell Script Introduction I have created a File Removal PowerShell Script that can be configured to remove files on various ways. I would like your opinions an suggestion on my scrip ...
user avatar
1 vote
1 answer
47 views

Fully parameterized PowerShell function for file removal

I would like your opinion on my Remove-Files PowerShell function. It is used in my File-Removal-PowerShell-Script. It is designed to be very flexible so a script ...
user avatar
3 votes
0 answers
101 views

Get specific properties for all Active Directory groups and all their users, then combine them into CSV

I've written a script that gets a list of all groups in AD along with a few specific properties for each group (DistinguishedName, CN, Type, and Description). Then it goes through each group and, for ...
user avatar
  • 131
3 votes
0 answers
313 views

PowerShell Script to get data from Third Party API and insert into database

I have created a PowerShell script that will call a REST API and then for each node returned, add the data into a database table. This particular endpoint only returns ~600 records worth of data, ...
user avatar
  • 327
3 votes
0 answers
97 views

Update AD Group based on CSV File

I have an AD Group I keep up-to-date based on a CSV file. Users not present in the file should be removed from the AD Group. ...
user avatar
4 votes
2 answers
85 views

Log writing PowerShell function

I am still learning PowerShell and I would like your opinion on my log writing function. It creates a log entry with timestamp and message passed thru a parameter Message or thru pipeline, and saves ...
user avatar
2 votes
1 answer
48 views

Deploy folder to desired path - PowerShell function

I am still learning PowerShell and I would like your opinion on my folder deployment PowerShell function. It basically check if a defined folder exists and creates it if it does not and writes it ...
user avatar
2 votes
0 answers
63 views

PowerShell Script to Harvest System Inventory

I've written a 'fast & dirty' PowerShell script to harvest a system inventory of Windows client and\or server operating systems to streamline case note documentation. ...
user avatar
5 votes
2 answers
393 views

Get username from full name - PowerShell function

I would like your opinion of my PowerShell function. Does it follow conventions, and what could can I do to improve it. It is made to create LDAP friendly username from a full name in Serbian language....
user avatar
7 votes
1 answer
236 views

Powershell script to verify Linux-generated md5sum file

I'm moving some files from a Linux machine to a Windows machine over a low-speed, possibly buggy experimental communications channel that I want to test. One of the tests is to transfer large numbers ...
user avatar
  • 64.1k
1 vote
0 answers
130 views

File Deletion PowerShell Script

I would like your opinion of my PowerShell script for file deletion. Do I follow conventions, do I use some anti patterns? Every critique is welcome! This is an example of a report log: This is the ...
user avatar
4 votes
2 answers
114 views

Powershell XML search performance

I am working on a utility to manage shared content libraries for Work from Home scenarios. Basically I have libraries of thousands of Autodesk Revit family files, and I want to host those files on AWS ...
user avatar
3 votes
2 answers
81 views

Smartly joining possibly empty strings

I want to join two fragments into one string with a separator, but when one of the fragments is empty I only want one of them. I have two implementations. The first is long and slightly repetitive, ...
user avatar

1
2 3 4 5 6