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

UserVoice request to add a Reverse-String cmdlet – please vote

submitted by /u/happysysadm [link] [comments] The post UserVoice request to add a Reverse-String cmdlet – please vote appeared first on How to Code .NET.

View Article


Converting C# to PowerShell using Roslyn

submitted by /u/l33t_d0nut [link] [comments] The post Converting C# to PowerShell using Roslyn appeared first on How to Code .NET.

View Article


Help with AD password change script

http://pastebin.com/5k3SpCyG I am having issues with my script which is supposed to create and apply a randomly generated password to an Active Directory account which is found by using “Get-ADUser”....

View Article

Format part of email body (bold some of the text) in Powershell

Hi, After a lot og googling without finding an answer I have come to you guys. I’ll try to keep this as short and concise as possible. The powershell script basically: Retrives a lot of values from an...

View Article

Help with function output

Hi guys ! I’m a bit stuck with how to handle the output of a custom function. This function should help detecting unused printer queues on servers : function GetUnusedPrinterQueues { [CmdletBinding()]...

View Article


Formatting CSV Output

Hey guys I’m wrapping up a tool to run some resource checks for our Server Monitoring group and here’s what I have as v0.1: $memT = 85 $cpuT = 85 While($true){ $mem = Get-WmiObject...

View Article

Could use some help using powershell to collect some data from a site

I’ve done this a few times, but I’m not a master by any means. I’m following instructions from the help files but I don’t seem to be getting the results I’m looking for. The site is here:...

View Article

Restarting a Service script that will work on Linux, Windows, and across all...

So it got asked among our team to gen up a script that would restart a specific service, but do so regardless if the box was Linux or Windows and work on all of our domains. I’m pretty sure I could...

View Article


How do I get the actual directory path when looping through a directory...

Hi Reddit I have a directory structure that looks similar to this: C:carsfordfiesta C:carsfordfocus C:carsbmw118i C:carsvwgolf C:carsvwpolo In each of the car model folders are reports generated daily...

View Article


Ideas for clearing spools from remote machines.

Hi guys, Recently, I re organised the way we install/manage printers at work. Before we just used to go around each machine and manually install printers, I know right. Now I have print management set...

View Article

What am I missing / doing wrong

Just trying to do a simple regex match but it is not giving me the expected results. $fp = 7d:87:19:ba:bd:8a:6d:ee:ea:a8:59:93:f:7e:e:a7 $reg ="([:][0-9A-Fa-f][:])+" PS:>$fp -match $reg...

View Article

How do I browse iPhone in Powershell

Windows 10 explorer path is “This PCiPhone” but dammit Jim I just cant get powershell to see this directory. I’ll i want to do is fire some searching and copying commands at the files on the phone....

View Article

ForEach loop – unexpected behavior

My ForEach loop seems to be exiting in the middle of the routine, then re-entering to finish. The result is that the instructions after the loop are executed twice. I’m not sure why this is happening,...

View Article


Question: Dealing with control characters in strings

Hi everyone, Today I’m dealing with some auto-remediation tasks. Specifically, I’m working with sfc to identify and resolve any integrity violations. Ideally, I’d like to have my script check the...

View Article

PowerShell to get Size on Disk of files

submitted by /u/bppereira [link] [comments] The post PowerShell to get Size on Disk of files appeared first on How to Code .NET.

View Article


Start-Process -Argumentlist syntax help

Hi guys; yet another argument passing issue. I’ve installed my software (UltraEdit/UltraCompare) just fine, but I also want my PS script to license it, as well. The command line provided to me by the...

View Article

Automatically remove a registered scheduled job once comepleted

Is there a way to delete/remove the registered scheduled job once its completed its task? If the restart fails or user wants to change the time, it will not let me because the name is already taken....

View Article


Test-Path using local credentials

I’d like to use test-path to validate the local credentials I have work. Below is what I’m using Test-Path "\Computernamec$" -Credential (Get-Credential -Credential "Computernameadministrator") The...

View Article

Select like object properties in Import-Csv loop

Hello friends, I have a csv file like the following: Time,ID,User 1/1/2017 1:00:00 PM,1,Bob 1/1/2017 1:01:00 PM,1,Bob 1/1/2017 1:02:00 PM,1,Bob 1/1/2017 1:03:00 PM,1,Bob 1/1/2017 2:00:00 PM,2,Joe...

View Article

How is PSReadline getting loaded on 2016/W10?

So Server 2016, and Windows 10 comes with PSReadline installed in C:Program FilesWindowsPowerShellModulesPSReadline. On a completely clean, brand new, install of server core 2016 the PSReadline is...

View Article
Browsing all 8793 articles
Browse latest View live