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

Boston PSUG: Managing the Infrastructure Stack – Nov. 1st

Hi! Just in case anyone in the area hasn’t heard, the Boston PowerShell User Group has been up and running since May, with our next meetup on November 1st. November 1st meetup details – Josh Atwell is...

View Article


Automation Guidance

I’d like to create a script to run, save, and email report attachments. We currently have a button macro that we use once reports have been saved, and it will generate the email with the attachments....

View Article


A practical use case for using PowerShell classes Part 2: Using Enums

submitted by /u/Stephanevg [link] [comments] The post A practical use case for using PowerShell classes Part 2: Using Enums appeared first on How to Code .NET.

View Article

Cannot correctly handle exceptions with Powershell

I have the following code: $count=0 try { $files = Get-ChildItem "D:somefolderfolderthatmightnotexist" -Recurse } catch { $count=$count+1 Write-Host "hello" Add-Content "D:log.txt" "$count...

View Article

Need some guidance on doing a find and replace in a file.

I’m working on some AWS/CloudFormation stuff right now and I’m having a bit of trouble with the userData script that gets run every time a new server is initialized. I’m a novice at Windows scripting,...

View Article


Split coma-separated line into an array

Hello, I have this: $test = Read-Host -prompt "Insert coma separated line here" $test.Split(',') The result will be like, test1 test2 test3 after the split. I then want to add each word into an array....

View Article

Image may be NSFW.
Clik here to view.

Cannot change language mode please help…cant run my scripts

im stuck in constrained language mode after doing some testing / hardening of powershell from gpo. now i cant run many of my scripts and all which is great BUT i cant revert back to full language....

View Article

Assigning permissions to subfolders and not parents

All, i have a tricky one that i’m not quite sure how to go about solving. I have a set of folders laid out like so: Project 01 subfolder 01 workfolder 01 workfolder 02 subfolder 02 workfolder 01...

View Article


What can I use instead of -OR

I am trying to write a simple script that I will be using in my compliance settings with SCCM. Historically I Have been able to do it like this (Get-Process -Name notepad -ErrorAction...

View Article


POSHspec question – I’m not familiar with Pester or this module yet

I’m trying to set up a poshspec test and am not sure how to use the Describe CimObject to check and see if a driver is installed and running. The Get-CimInstance query I would usually run is:...

View Article

powershell help

hi everyone i have a problem with a script i am trying to run, the script will give me the full path of folders and files, the last time it was modified before 1/1/2016 and an option to see if its a...

View Article

Best Practices with Packer and Windows

submitted by /u/MattHodge [link] [comments] The post Best Practices with Packer and Windows appeared first on How to Code .NET.

View Article

Expand-Archive source

this may be old news to most of you, but i was using expand-archive and it gave me an error that referenced this file, so i opened it and i thought it was an interesting read, especially the...

View Article


looking Disk response time

So in Resource Manager there is a section under disk called response time (ms). I am looking for a way to see this info in powershell. So for I have been unable to find anything to show this. We have...

View Article

Copy file to multiple machines and execute

I’m hoping someone can help me put together a simple powershell script that would: Loop through a .csv file of system names Copy an .exe file to each of the machines listed in the .csv Execute the...

View Article


script to read list of files from text file and print them

I have a list of file paths, listed in a text file as follows: http://localserver.localdomain/folder/filename1.pdf http://localserver.localdomain/folder/filename2.pdf...

View Article

Lock folder structure for network shares

I’ve read countless different ‘solutions’ for this over the years.. none of them really worked or made sense. I’ve found that this works for me. We all have that network share that has a certain...

View Article


Faster search?

I’m trying to search and get the count of files with a specific search string. $String = Read-Host -prompt "What string to search for" $Count = (Get-ChildItem -Recurse | Where-Object { $_ |...

View Article

PowerShell Training: Sorting Version Numbers

submitted by /u/michaeltlombardi [link] [comments] The post PowerShell Training: Sorting Version Numbers appeared first on How to Code .NET.

View Article

Connect-VMNetworkAdapter problems

I’ve been working on a script to make a VM, and this is the segment that’s busting my balls. $VMName = "Unifi" $VMSwitch = Get-VMSwitch -SwitchType External | Format-List -Property Name...

View Article
Browsing all 8793 articles
Browse latest View live