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

Script to output MAC to CSV

Hi,   I have what I believe to be a very simple problem. I have CSV that I am trying to maintain and update via powershell. The CSV is already created, so I just need to add to it. The path is...

View Article


Migrating User Profiles & Resetting Permissions [Windows Server]

I would love some feedback on this if possible, i have a write up on the blog post with some reasoning for this script....

View Article


help iterating over a string

This works perfectly in ISE, but not a normal PS session – even as administrator. $msg = "TEST" $msg = $msg.toCharArray() foreach ($letter in $msg) { write-host "This is the letter " $letter } It...

View Article

Problem with character coding when exported to clipboard.

As part of my PowerShell profile I have a function that creates passwords. To help readability I have only a certain set of characters that the password must come from – but that is probably not of...

View Article

[Question] Does this script securely authenticate a user’s credentials with AD?

I’m trying to force user’s to log in and verify their identity before being able to access a script. Just checking for a domain account isn’t sufficient, I want to essentially implement LDAP...

View Article


Assist with Error Handling

Hello all – I’m somewhat fresh to powershell scripting, at least for things more than one or two lines. I have a script I’ve been working on that uses a number of instances of get-wmiobject to connect...

View Article

read password from encrypted file

Hi Guys, i’ve got a Script that uses credentials from an other user to create a file on a network storage. At the Moment the password of the user is stored in plaintext inside the script. I’d like to...

View Article

trying to get every pc in the office’s Computer model, user, and serial number.

this is what im trying to work with. sorry if the answer is simple, i’m new to powershell. $computers = Get-Content -path C:chi_desktops2.txt $log = -path “c:laptop_log.txt” foreach($computer in...

View Article


Do something 10 times, or until a command succeeds.

So here’s my issue. I am trying to move a user to a new OU in Active Directory. I want to make sure that the user moves successfully before moving on in the script. Here’s the logic I came up with:...

View Article


Running Module on remote machine

Hi, I’m trying to invoke a module to run on a hundreds of remote servers. The plan is I want to kick-off Windows Update on them at once. I have the PSWindowsUpdate module, but the Invoke-WUInstall...

View Article

Learning PS, Workflow, Output to File

Hello! In my new position at work, I’ve been learning powershell to automate various things. I’ve been tweaking this one script that I created, but I am running into issues. The Purpose: To scan a...

View Article

Encrypted PGP Passphrase

Can anyone help me on this? I’m trying to store the pgppassphrase in an encrypted text file. I encrypt the file like this. $pgppassphrase="Password123" $pgppassphrase | ConvertTo-SecureString...

View Article

I want a custom New-ADComputer but what do I call it? (Namespacing question)

I thought about prefixing all my cmdlets that override originals with “My” or the company initials but… I… don’t… like that. PS> MyNew-ADComputer PS> ABCNew-ADComputer Though I haven’t tried it...

View Article


Using powershell to rename files.

Hi there. I’m moving my Plex library from my main desktop to my QNAP NAS. All of the files that needed to be trans-coded has been trans-coded but I am in a predicament. So I need to get powershell to...

View Article

Learning Powershell – Question about Formatting my results

I was working on setting up a little script that will let me get information on what monitors a workstation has connected to it. I can get the results I want, but the formatting is a little odd. If a...

View Article


Creating new users from SQL server changes?

Maybe I am looking at this the wrong way, not having much luck finding an answer. Currently HR inputs new users/terminations into their excel document, and manually email out the changes. I can then...

View Article

Can someone explain UTC offset to me (x-post r/sysadmin)

Doing some troubleshooting on a device located in E/T and I checked last boot via wmic. I understand the first part of the string (date/time) but can’t figure out the part after the decimal (see...

View Article


AD User Creation Date

Is there a script I can use to get the date a user account was created? It’s in a separate domain so I’m unable to use Quest in that environment. submitted by /u/404AikNotFound [link] [comments] The...

View Article

Dynamic Parameter Help

I could use some help on a script that I am building for work. I have removed bunch of stuff an have edited because its work related. This is my first script trying to use Dynamic Parameters. The...

View Article

looking for some help on a script

So I am looking to make a script that when a user runs it they can select from a list of network printers and have that printer they selected added to their profile. Any ideas how to go about this?...

View Article
Browsing all 8793 articles
Browse latest View live