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

Get-Content with argument -Tail takes indefinite time

When I execute Get-Content -ReadCount 0 -encoding String -path $file.FullName on a file, it dumps the hex content within a minute, but when I execute Get-Content -ReadCount 0 -tail 1 -encoding String...

View Article


Permissions with powershell

I am trying to add object inherit and container inherit to a permission statement but I keep getting the error “cannot find an overload for filesustemaccessrule and the argument count:4” I cant seem...

View Article


String Manipulation

So I have a log file where I need to grab some information from the last line. I run this command to grab the information from the last line of the file. $Log = (Get-Content ".LogFile.log")[-1] PS...

View Article

Creating a profile to include all PSM1’s – Am I doing this right?

I am trying to piece things together now that I have everything broken down. Maybe I’m not doing this correctly; any insight would be appreciated. I have a few PSM1’s that I generated based on a lot...

View Article

Reading a local .htm file

I’m having troubles making a script that reads a local .htm file. Here is my script so far: $html = Get-Content “C:Usersolsonc01DesktopHtmlTestCDW Quote Confirmation Quote #1BNQ7ZWP.O. Ref. KAY...

View Article


Capturing a Filename and Using Later

Bear with me here, I’m working with powershell for the first time. Goal: open a csv file, and overwrite the same file. Here’s what I have so far: $excel = New-Object -ComObject excel.application...

View Article

Help with returning samaccountname

Hey guys, Hoping you can help! I’m trying to return samaccountname but my issue is that the account names are not being returned. Here is the script i’m running: $Users = gc...

View Article

Does anyone have any experience with PowerShell server?

I’m looking and working with PowerShell server v6 from nsoftware. http://www.powershellserver.com Tried posh it was just a bit problematic at times. submitted by /u/Budman17r [link] [comments] The...

View Article


New-Item and mkdir Are Telling Me Lies!

I have a problem creating a folder on a CIFS share from our NetApp SAN. If I create the folder using Windows Explorer, it works. If I create the same Share and parent structure on a Windows server, it...

View Article


AD, Out-Files, loops, AND critique my code

I’m trying to write up some scripts to help with employee terminations. I want to run a script first to log the selected accounts and store them in case of a reversal. The script pulls from a .csv:...

View Article

Count multiple occurrences of substring in strin

I have a single line string that looks like so: “CN=Group1,OU=Distribution Lists,OU=organizationalunit,DC=domain,DC=com CN=Group2,OU=Distribution Lists,OU=organizationalunit,DC=domain,DC=com...

View Article

Cannot figure out how to feed a list from a text document into an array

I’m trying to add a lot of domains to an app in Azure. This works: Set-AzureRmWebapp -Name “cvproddashboard” -ResourceGroupName “cvprodwestus” -HostNames...

View Article

Is it possible to call a function inside another function

Hey, I was wondering if there was a way to call a function inside another function. For example if i have this function function bold($word) { $word = "<b>" + $word + "</b>" return $word }...

View Article


Check for existing filenames – if exists use next number…

I want implement a check in the version portion to write the file as the next number in the sequence. So if I have TechProfileVersion001.txt already created, I want it to write the next one as...

View Article

AdEmbargo – A script to block ad traffic to all applications.

submitted by /u/HazrMard [link] [comments] The post AdEmbargo – A script to block ad traffic to all applications. appeared first on How to Code .NET.

View Article


Working with CSV’s – duplicates and null values

Hello /r/PowerShell ! I’ve been working for a while on a script to automate AD account management for the school system I work at. Having never really used PowerShell before, I’ve really gained a...

View Article

Creating Class-Based PowerShell Tools

submitted by /u/luonggillian [link] [comments] The post Creating Class-Based PowerShell Tools appeared first on How to Code .NET.

View Article


Working With Arrays

I am looking to create a function to gather inputs for an array. I can only find the param value that would go within another function, however I would like to have something that users could do once,...

View Article

My pet peeve – not including a Credential paramter in your functions

I see this constantly – users run PowerShell as an admin account, and simply run their entire session as their domain/server admin account. I really have a few issues with this: It doesn’t follow...

View Article

Potential breaking changes to Group-Object in Powershell 5

submitted by /u/gbrayut [link] [comments] The post Potential breaking changes to Group-Object in Powershell 5 appeared first on How to Code .NET.

View Article
Browsing all 8793 articles
Browse latest View live