Quantcast
Channel: /r/powershell – How to Code .NET
Browsing all 8793 articles
Browse latest View live

Sort-Object on ForEach Loop

Hi, I’m trying to Sort-Object on the results of a ForEach loop and it doesn’t seems to be working as expected. The source of the data is from a column in a SharePoint list and i’m trying to sort the...

View Article


Script that takes a CSV file and adds AD extension attributes

I’m having trouble creating a script that takes a CSV file and reads the information inside to add AD extension attributes (attributes 10 and 11). Attribute 10 will be a value of 1 and attribute 11...

View Article


Run an .exe file remotely from a UNC path

I am trying to use Invoke-Command to run an exe from a UNC path on a bath of computers and cannot figure it out… Invoke-Command -ComputerName $Computers -Credential $cred -ScriptBlock { Set-Location...

View Article

“Process cannot access file… being used by another process”

Good morning everyone. I have a simple script to copy all the Windows 10 spotlight lock screen wallpapers from a Windows directory, and then rename them all to *.jpg. The following script accomplishes...

View Article

[Question] How would i find duplicate timings in this dataset

I have a data set that is like this which is stored as a string in an array of objects Timestamp --------- 2016/07/27 21:15:25.394 2016/07/27 21:23:38.598 2016/07/27 21:40:56.448 2016/07/27...

View Article


Trying to create function that deploys program. Need help.

What that function should be doing (beside checks): * -Copy installation folder to the remote computer * -Invoke command to start installation (where the problem is) * -Remove installation folder...

View Article

.Substring not working? Not sure why..

I have a pretty simple block of code I’m working with. I want to get a FirstName and a LastName from user input and create a username with the first initial and the last name. E.g. John Doe should be...

View Article

Beginner requesting help: If/Else, Do/Until, and looping.

Hi everyone. I’m working on a script to build out remote servers. As part of that script, I create a new PSSession, join the server to the domain, and then reboot the server. I’m trying to get my...

View Article


Question about starting to use powershell/take a class.

So, I work for an MSP, and right now we do very little with scripting and such other than what scripts are built into our Labtech program. I would like to see that change, and I know that one of the...

View Article


How to update to latest Insider Preview from Powershell command?

I haven’t figured out how to initiate a Preview install from a command, I have to manually install from Settings. submitted by /u/trogdor3000 [link] [comments] The post How to update to latest Insider...

View Article

Querying a list of remote servers with Get-WmiObject… very slow… is it...

I’m going to be writing a script which will query a number of server statistics across a list of servers that I have in a CSV file. This will run every 5 minutes and continue to append the data to a...

View Article

Get-DfsrFileHash results in the same hash for 2 different files.

I tried this on two different computers so I’d be interested to see if you can re-create it. I was using the Get-DfsrFileHash to confirm that some Robocopy jobs completed successfully. When I was...

View Article

The wrong way to schedule a task

I’ve been asked to use Fire Daemon to run a powershell script. Essentially what happens is this: Multiple instances of the script run in parallel. What I’ve discovered is that I need to recreate the...

View Article


IF/Else Get-ADUser

Basically I’m reading from a text file that has usernames in it but I also want to be able to mix in EmployeeIds to also return all the ALL of the PROPERTIES. By using If/Else I can do a regex… 9...

View Article

Being forced to update old code, not sure how to do this?

My manager wants all VB code “converted” over to powershell. That’s all fine and dandy, i have done this for over a couple dozen scripts. I’ve converted 100 lines of VB to a POSH one-liner, and i felt...

View Article


Can one PS instance interact with another PS instance?

Can one PS instance interact with another PS instance? I know I can use PS Jobs and PS Sessions, but I am more asking if a new PS instance started up while one is already running. Can they talk to...

View Article

DSC Resource Kit Community Call August 3

submitted by /u/PowerShellChallenge [link] [comments] The post DSC Resource Kit Community Call August 3 appeared first on How to Code .NET.

View Article


Monitoring exchange via remote powershell – works if the service account is...

Hi all, I’ve got a scenario where a monitoring system (PRTG) executes some powershell scripts to check on various aspects of exchange and underlying OS functions. Some of these scripts call exchange...

View Article

Writing Windows Services in PowerShell

submitted by /u/psrdrgz [link] [comments] The post Writing Windows Services in PowerShell appeared first on How to Code .NET.

View Article

Numbers not sorting in Powershell ISE.

I have a lotto generator that I created to learn Powershell and Forms. I run the array through Sort-Object and when I run it in PowerShell ISE, the numbers don’t get sorted. If stop the script and...

View Article
Browsing all 8793 articles
Browse latest View live