PowerShell is a command prompt and a scripting environment designed for Windows system administration.

learn more… | top users | synonyms

7
votes
0answers
27 views

Powershell to quickly ping a number of machines

I came up with the below code to improve the peformance of pinging a large number of machines. At present it's fairly basic, but thought I should see what people thought before proceeding further. ...
2
votes
1answer
33 views

PowerShell Unpivot Object

Based on a question on SO I thought I'd knock up a cmdlet to perform an unpivot on an object. I've not yet considered all the options (e.g. what happens when objects with empty lists are passed), so ...
5
votes
1answer
55 views

Import Excel, unpivot data, output tab-delimited for SQL Import

I have a client GL file (Excel) that needs to be regularly imported to SQL Server (as tab-delimited txt). Sample (simplified): ...
2
votes
1answer
170 views

Delete folder if it exists in PowerShell

In my PowerShell script I'm trying to delete a folder, but only if it exists: if (Test-Path $folder) { Remove-Item $folder -Recurse; } I find myself repeating ...
4
votes
1answer
71 views

Getting a list of all computer objects in each AD domain

So I wrote this script and although it does work I can't help but think that it can be more efficient with all the repetitive code. Can anyone offer any suggestions on making it fewer lines and ...
2
votes
1answer
46 views

Powershell photo sorter/mover

I'm just beginning in Powershell - This will be my first full project, start to finish, and it's quite small. I have already had experience in C#, which helps in this .Net based language. This ...
2
votes
1answer
65 views

Convert list of UTC to Current TimeZone

I found myself with a list of UTC timestamps and wanted to convert them into the local time zone. Using this web post as a starting point, I modified the script to grab a text file containing UTC ...
3
votes
0answers
72 views

MD5 hash comparison for two folders

Using this page for a starting point into comparing MD5 hash values from files in two different folders, I've put something together that outputs either Copied if ...
-2
votes
1answer
40 views

Extracting first initial and last name [closed]

How can I do this better? $a = "Tom Smith" ; $e = $a.substring(0,1) $ee = ($a).split(" "); $y = $e + $ee[1]; $y TSmith
6
votes
1answer
286 views

PowerShell within HTA

I've put some code together that helps me search an internal ticket system using an HTA application with some TextBoxes and some embedded VBScript that runs PowerShell scripts. The PowerShell scripts ...
1
vote
1answer
173 views

Write to the event log without needing to check whether or not it exists by use of a `-Force` parameter

Below is some powershell to write to the event log; if the -Force parameter is specified this saves you the effort of writing additional code to first check whether ...
3
votes
1answer
84 views

Backing up single-user PC data

I wrote a PS script to backup data from single user pcs to their network homedrive. The purpose of this tool is to save some time and ensure process consistency when reimaging/replacing machines. I ...
8
votes
1answer
605 views

Powershell search millions of files as fast as possible

I once asked a similar question but in C#. Now I have the same problem in powershell.. What is the fastest way, to search files newer than 15 minutes, in a file system with more than 1 million files? ...
4
votes
3answers
644 views

Powershell script to create folders on remote servers

This is pretty much the first Powershell script I've ever done and I am here looking for a quick review of it. Is there something I could have done better? Is the format okay? I don't know much about ...
3
votes
0answers
40 views

Recycling Internet Explorer

Is there anything I can do to this code to optimize it to use less resources? ...
4
votes
2answers
138 views

Getting essential computer info for network admins

I recently had to install VNC on mass across a lot of computers on a domain and needed some info about their PC, for example: Host name Username MAC Address IPv4 Address Domain name Once all of ...
5
votes
1answer
225 views

Active directory password changer

I have written this Active Directory password changer script. Comments and testing is appreciated for things I may have overlooked, since this is my first AD Script. There are two parts: PHP and ...
3
votes
0answers
147 views

Powershell Windows Service Deployment

Based on this with a couple of changes. Any issues you can point out would be great. param([string]$targetServer, [string]$user, [string]$pass) ...
2
votes
1answer
358 views

AD update from CSV

I get a CSV dump of all employee records from our payroll system once a week. The CSV has something like 28K records. The key between the two systems is the ...
2
votes
1answer
128 views

Adding file name information to CSV file columns

Is there a simple way to combine the functions of this Powershell script? It would be nice to have it file to one output file instead of several output files. ...
3
votes
1answer
231 views

Create Dummy Files for Testing

I have two different folders. In one folder, I have files that will be exported to a remote site via FTP. In a second folder, I have .dat files that will be processed by a ftp client program that ...
4
votes
1answer
622 views

PowerShell Active Directory Browser

I've just published ADExploder. It's a single-script PowerShell app (source) that uses classic Windows Forms and the Directory Services API to be able to browse nodes and properties of Active ...
4
votes
1answer
159 views

PowerShell script to automate the search of DLL files

I often write different applications in C++ using different libraries, and sometimes it takes a lot of time to find where are the *.dll files to distribute. I use ...
4
votes
1answer
553 views

A PowerShell script like one-way rsync but worse

This PowerShell script works a bit like a one-way rsync; it's good enough for my Surface RT needs, anyway. However, seeing as this is my first PS script, and I was ...
1
vote
1answer
160 views

Writing a small script to extract MS Exchange audit logs in .csv format

Background I'm using MS Exchange 2013 in my environment, and have a separate siem box which analyze logs produced by different systems (i.e exchange). The logs for Exchange are internally stored and ...
5
votes
1answer
180 views

Fastest Windows script to move files from one did to a network dir

I wrote a script that moves files older than two days over to a network share (via scheduled task). Windows Task Scheduler doesn't seem to like the script so much, but it works well by itself. Is ...
5
votes
1answer
217 views

Convert list of parameters to a string that can be invoked

My PowerShell scripting skills are pretty poor, but I've managed to hobble together got this script: ...
4
votes
2answers
3k views

Extract version string from text file with Powershell

I need to pull the version # out of a Vim script that might look something like: ...
5
votes
1answer
82 views

Script which migrates files to secondary storage and symlinks them

I wrote this code to clean up some of the space on our file server. We've got 15 years of legacy data that nobody accesses or changes or cares about that we have to keep regardless. I'd rather have it ...
2
votes
1answer
456 views

Is there a way to simplify this powershell script?

This script uses robocopy purge with list command to out what would be purged it then parses that log file and checks each file and only deletes files older than 7 days. Is there way it could be ...
4
votes
1answer
1k views

Recursive Windows Directory listing

I wrote a PowerShell script for a superuser question: list of all files and directories under a path recursively, without recursing into junction points or links I have a strong feeling that my ...
1
vote
1answer
121 views

Test finder PowerShell cmdlet

I am learning PowerShell, and created the following script cmdlet. It reads one or more specified script files, to discover ...
6
votes
2answers
2k views

Updating multiple svn repositories using powershell

I wrote a script to perform svn update on all the SVN repositories inside a folder. It would have been great if the folder containing all these repositories itself ...
2
votes
1answer
103 views

Summarize a directory with PowerShell

I'm trying to output aggregate information about a directory tree (file extension plus accumulative count and size per file type) with PowerShell. This is as far as I've got. ...
3
votes
1answer
128 views

Can this Powershell be simplified?

I wrote a script to remove .vb code files when there are corresponding .cs files in a certain directory structure. But I felt like there were some extra statements that I had to put in there that ...
5
votes
1answer
515 views

Inspecting properties of files

...
5
votes
0answers
681 views

PowerShell module for formatting objects using Razor

I managed to get something up and running, but I've no idea whether there are better ways to do this. I've spent all morning trying to figure out the best way to use parameters (allowing objects from ...