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

New Function: Get-WorkingCredentials – Get credentials that grant access to a...

Link to function: https://github.com/pldmgg/misc-powershell/blob/master/MyFunctions/Get-WorkingCredentials.ps1 I wrote this function because I was having a difficult time interpreting Invoke-Command...

View Article


encrypt API keys in PS Scripts

Anyone know of a way to encrypt API keys if you use a PS script to pull API data? Right now it only seems we can drop the file, execute, and erase it, while restricting the keys usage to certain ip...

View Article


USB Synchronisation

Hey all! me again, little question here… Does anyone know why the following script is not returning me the whole object of the USB but instead shows me only the DeviceId? I’m trying to create a script...

View Article

Remove arbitrary string from array, and put it back later

I’ve got a very long text file, in it is a known string. Occasionally I want to remove that string then add it back in again after 30 minutes. At the moment I read in the entire text file with $file =...

View Article

VS Code powershell themes

So I know the PS extension for VS Code comes with an ISE-shyle theme. It’s not perfect, and I’m slowly getting the feeling that a darker theme would be preferable for my poor eyes. What theme do you...

View Article


Performing comparison operation, need to extract string from InputObject

$Difference = Compare-Object -ReferenceObject $CurrentMembers.WindowsLiveID -DifferenceObject $UpdatedMembers.Email -IncludeEqual ForEach($object in $Difference){if($object.SideIndicator -eq "=>")...

View Article

Error catching

I am trying to use $var = get-adcomputer $computer in a for each loop to get ou locations. This all works great but my file is serial numbers which 25% are not computer names. This returns an...

View Article

New to powershell, need help automating a task

It’s pretty simple: i want to automate a task i do several times a week for customers with a script (if possible). It’s relatively simple what i want to do: Create a folder called dns_logs on the C:...

View Article


Start-Job usage and inefficiency

Hello, For simplicity sake I am going to use the below as an example: do{ $runningJobs = (Get-Job -State 'running') if ( $runningJobs.count -ge '6') { sleep -Seconds 10 } else { Start-Job -ScriptBlock...

View Article


Loading a MIME-encoded file (.eml) directly into Net.Mail.MailMessage

Hi all, So I built a web service a while back that once a day spits out a fully inlined .eml file, which I’ve up until now used a call to blat.exe from PS to send. For Reasons, I can’t use blat any...

View Article

Using Powershell for unattended installation of Windows Server 2016 on...

Hi all, I’m currently working on a script for an unattended install of Windows Server 2016 on a Virtual Machine. I got the script to create the VM with the desired configuration and to boot it with...

View Article

Robocopy – copy ONLY from source to destination

Hello! Thank you in advance for your help, I’m having a little trouble with a robocopy command I’ve written. I’m trying to transfer files from a local hard drive to an NFS share, and copying from...

View Article

Need script to search text of PPTX,XLSX,PDF files for PII (SSN)

I found a snippet of script that lets me search .txt files for patterns matching a SSN, but now I need a script to do the same thing for powerpoint, excel, and pdf files. Does anyone have a snippet to...

View Article


A script to grab the newest video-link on Youtube channel?

Okay this is probably a stupid idea but i have been thinking of a script that grabs and pastes the url-off a new upload to, say a file or email and then forwards it. I have been talking with my...

View Article

Having trouble writing Powershell from a cURL command.

The API documentation uses cURL for examples, however I would like to use Powershell. Example; curl -v -X PUT -H 'X-Api-Key:{Admin_User_Key}' -H 'Content-Type: application/json'...

View Article


Trying to show AD computer objects per OU by name and OS

Hello /r/powershell I’m trying to edit the script below with the goal of getting a CSV that shows a list of computer objects per OU along with the name, count (in the case that there are duplicate for...

View Article

Is there a way to “capture” a DSC config

Can I take a machine and somehow store what would currently be the DSC config, even in a non perfect form, or a module at a time? Basically are there any shortcuts to starting from scratch and...

View Article


[Question] Is it possible to match attached UPD’s to users that are logged...

Hi Guys, Running a broker server that load balances to 4 session hosts. The UPD’s are named based on the AD attribute objectSid e.g “UVHD-S-1-5-21-3199994005-3499998621-1869999552-9999.vhdx”. It is...

View Article

New User Creation – Write Successful Additions to Text File

Thank you in advance for checking out my question. I have only been scripting for the past couple of months, so I will apologize in advance if my terminology is not on point. Trying to simplify our...

View Article

Anyone familiar with ScriptRunner?

Here is the website. https://www.scriptrunner.com/ Thinking about reaching out for a demo and pricing info. Planning on deploying Jenkins in a couple of months once the IT department is staffed up,...

View Article
Browsing all 8793 articles
Browse latest View live