Questions tagged [powershell-5.0]

For issues relating to Windows PowerShell, version 5.0

Version 5.0 of Windows PowerShell, Microsoft's task automation and configuration management platform that functions as an interactive command shell and a scripting language. For general information about Windows PowerShell, see the tag wiki for the tag.

Windows PowerShell 5.0 is available as part of the Windows Management Framework (WMF) 5.0.

For the latest news and developments, check out the PowerShell blog.

909 questions
0
votes
2 answers

Test-Path Move-Item Problems

I run this PowerShell script, and it works fine on PowerShell 4.0. But I now have PowerShell 5.0 and the script does work but it throws an error: The Script: $path = "X" $destination = "Y" while (Test-Path -Path $path) { Move-Item -Path…
Djbril
  • 745
  • 6
  • 26
  • 48
0
votes
1 answer

Powershell -replace command is replacing $_ string literal from within the replace string

I am new to powershell scripting. I have tried to develop a script using powershell major version 5. The objective of my script is to replace few string literals in a template file, with some strings. Note that, one of the string literal is…
0
votes
1 answer

Find method has syntax error when using LookAt

I have not been able to make work this simple command $Range.Find($SearchString,LookAt:=xlWhole) It returns syntax error. Without LookAt works fine, but I need exact match
LiRU
  • 1
  • 1
0
votes
0 answers

Difference in handling Get-ChildItem between PowerShell and PowerShell ISE?

I'm getting a difference in the handling of Get-ChildItem between running it in a PowerShell window and in the PowerShell ISE Test directory with 5 fives, test01.txt though test05.txt $orbdata = 'C:\spool\RBDEV\data' $srcfiles = @(Get-ChildItem…
SteveC
  • 15,808
  • 23
  • 102
  • 173
0
votes
0 answers

In PowerShell, is there an "on installation" event (for Install-Module)?

When I define my own module with a manifest, I have the option to run a ps1 upon import of my module (ScriptsToProcess) (Import-Module). Is there a similar hook for that triggers upon install (Install-Module)? I'm asking because support for the…
Casper Leon Nielsen
  • 2,528
  • 1
  • 28
  • 37
0
votes
1 answer

Specify Select-Object Details at Runtime

I'm using Get-WmiObject to dynamically query an SCCM namespace using the following construct: $wmi = Get-WmiObject -ComputerName -Namespace Root\SMS\SITE_ -Query $query -Credential $credential Is there a way to allow the…
Jaime Still
  • 1,949
  • 20
  • 31
0
votes
1 answer

How to uninstall Powershell 5.0 from Windows 7?

I have been searching it for a long time but didn't found any answers to it. I have also checked powershell.org and found this solution : wusa /uninstall /kb:2969050 but when i tried , it came out with the result that this update was not installed…
Kaushal
  • 41
  • 1
  • 6
0
votes
1 answer

Prevent PowerShell Select-String from parsing colon as a drive letter

I have a profile that gets executed every time I open my PowerShell window. Since I do some SSH'ing, I need to ensure that my gets added right after I start up PowerShell. But I want to avoid asking my passphrase for the SSH as long as it's already…
tambre
  • 4,625
  • 4
  • 42
  • 55
0
votes
1 answer

PowerShell async download completion event handler never gets executed

I'm trying to create a PowerShell script that would download posh-git and then install it automatically. I'd like to have the download happen asynchronously, preferably with the option to have a callback once the download has finished and/or be able…
tambre
  • 4,625
  • 4
  • 42
  • 55
0
votes
1 answer

Powershell GCI Recursive Depth Stops Working When Adding Include Parameter

I have what I'm assuming to be a simple question. I have a large block of code that I have written. In short, it downloads a dynamic list of file names and extensions, imports a csv with the roots of every one of our shares, and compares the files…
Nick
  • 1,178
  • 3
  • 24
  • 36
0
votes
2 answers

Formatting columns of HTML output depending on their value

I'm trying to apply conditional formatting to the output of a simple PowerShell function: function Get-RamInfo { $os = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $ComputerName $cs = Get-WmiObject -Class Win32_ComputerSystem…
Craig Smith
  • 37
  • 1
  • 7
0
votes
1 answer

WSUS Function not displaying update title

I've written a small function that displays WSUS updates ready for approval: function get-WSUSInfo { $wsus = Get-WsusUpdate -Classification All -Approval AnyExceptDeclined -Status Needed foreach ($update in $wsus) { $props = @{ …
Craig Smith
  • 37
  • 1
  • 7
0
votes
0 answers

Strange behavior when converting from a `.json` file that contains an array

I have the following JSON file (it's a bundleconfig.json file from a VS project): [ { "outputFileName": "Scripts/a.js", "inputFiles": [ "Scripts/b.js", "Scripts/c.js" ] }, ... ] and I'm parsing it like so: $json =…
lalibi
  • 3,057
  • 3
  • 33
  • 41
0
votes
2 answers

PowerShell Register-ScheduledJob cmdlet - Set "Run Only When User Is Logged In" & -WindowStyle Maximized

I want to set these two options for a dynamically-created scheduled job, Going through the PowerShell documentation, I couldn't find any results.
Ohad Benita
  • 533
  • 2
  • 8
  • 26
0
votes
1 answer

POWERSHELL ISE Bulk/Batch select for encoding conversion (Get-Content & Set-Content)

POWERSHELL ISE Hi, I'm trying to write a program that will grab all .txt files in an input path, change the encoding, and send the new .txt files to an output location. I have it working based on single text boxes. I'm not exactly sure how to set…
JohnnySemicolon
  • 255
  • 2
  • 8