Unable to start scriptblock as background or remote job, works fine executing directly

Powershell
I have a scriptblock I would like to run as a background job. Below is the command I would like to run: Get-ChildItem -Recurse $source | Get-DfsrFil...
3 years ago

how to export a class in powershell v5 module

Powershell
I've got a module setup to be like a library for a few other scripts. I can't figure out how to get a class declaration into the script scope calling ...
3 years ago

Create a PSCredential with empty username

Powershell
I need to create a PSCredential with an empty username. $Password = ConvertTo-SecureString -AsPlainText -Force -String 'a' $Credential = New-Object -...
3 years ago

Installing PowerShell module persistently for all users

PowerShell
I'm installing a PowerShell module via Octopus Deploy onto a number of different servers. For testing purposes, I went with the guidance of Microsoft'...
3 years ago

rename and copy Powershell - too complex script

PowerShell
I wrote a script to copy a file, but this file already exists in the target directory. So, first I need to rename the original file. The script work...
3 years ago

Powershell resume script after reboot

PowerShell
I am currently working on a school assignment where i have to make a couple of powershell scripts to perform a basic configuration of a windows server...
3 years ago

Object manipulation in PowerShell

PowerShell
Is there a way to manipulate the content of the Object so that the output shows the applications present on DESKTOP A? $DB_struct = Import-Csv -Path ...
3 years ago

Installing Heroku Toolbelt on Windows 10

PowerShell
I've been having some issues installing the Heroku toolbelt on Windows 10, 64-bit. It's the first time I install Heroku. I downloaded it from https:/...
3 years ago

How to get current username in Windows Powershell?

PowerShell
How to get the current username in Windows Powershell?
3 years ago

Extracting numbers in text file

PowerShell
I have a text file which came from excel. I dont know how to take five digits after a specific character. I want to take only five digits after #ACA ...
3 years ago

Getting the CPU, memory usage and free disk space using powershell

PowerShell
Could you help me combine these three scripts to a format that's like this ComputerName CPUUsageAverage MemoryUsage C PercentFree xxx ...
2 years ago

Powershell and wmi, how to map logical disk/volumes to a hard disk or vice versa?

PowerShell
Get-WmiObject -ComputerName $ip -Credential $credential -Class Win32_logicaldisk This gets me disks as I see them in "My computer", eg. C:, D:, E: N...
2 years ago

output will not format correctly

PowerShell
I am having some problems writing to a text file with powershell using the correct format. I am pulling some windows event logs and saving the output...
3 years ago

put a powershell script on path through powershell commands.

PowerShell
I have a powershell script that I want to run from cmd/ps any location by putting it in path. What is the command that can achieve that ? I m basi...
3 years ago

Redirect powershell in batch file works to file but not to null

PowerShell
The following line of code (in a 'Administrator' cmd window on Windows 10) outputs the title of some open windows to the me.txt file, and not to the s...
3 years ago

powershell Test-Path is not recognized as a cmdlet

PowerShell
As a follow up to my question powershell if-else does not follow either branch I've found another odd situation. I have a script that is running as a...
3 years ago

Capturing user input from a powershell workflow

PowerShell
I have the following: Workflow Test { $message = "Hey" InlineScript{ Write-Output $using:message Read-Host 'Get user input be...
3 years ago

powershell to return and log redirected site?

PowerShell
Afternoon all, Trying to create a script to go to a webpage and log if it is redirected to an expansion server. For example the site is site.school.ne...
3 years ago

PowerShell Not Returning to command line after running "dotnet run ..."

PowerShell
I'm currently trying to build a PowerShell script that need to start my own C# application as Service and then after I need to check back the event lo...
3 years ago

Regular expression matching in PowerShell

PowerShell
Is there an elegant one-liner for doing the following? $myMatch = "^abc(.*)" $foo -match $myMatch $myVar = $matches[1] I'm interested in the $myVar...
3 years ago