Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [powershell-4.0]

The tag has no usage guidance.

0
votes
0answers
46 views

Checking for a file whether it is readable and regular in powershell

I'm new to powershell and I want to check if file in readable and regular. In unix we can do it by using -f & -r. For example the following shell script function accepts filename as argument and ...
0
votes
1answer
692 views

My commands in runonce are not running

I'm writing a script that is intended to automate the process of promoting a new domain controller where no domain previously existed. I've been consistently caught up on how to get the program to ...
3
votes
2answers
846 views

PowerShell issue - IF statement curly brackets

I’ve come across something with PS and I don’t know if I’m doing something wrong or maybe it is just a bug in PS (and I can’t find the answer anywhere)? I’ve tested this with PS v4, v5.0 and v5.1 ...
3
votes
2answers
1k views

stop-computer : Privilege not held

I am running Powershell (v4) on a Windows7 box ; I was able to until yesterday (2017-04-12) to issue a 'stop-computer' command to shutdown my computer. Today: I am unable to do so; I get this ...
1
vote
1answer
528 views

PowerShell script stops after running If statement

I'm stumped. I'm running the below code on a 2012 R2 box while I develop it. All this piece does is get the hostname, grabs the number off the end, runs a function to see if it's an odd or even, then ...
2
votes
2answers
2k views

Powershell Custom Properties - Change Property name

I have a custom object, and I would like to change the property name of one of the existing properties. Is that possible? I know I could create a new property with the new name, copy the values from ...
0
votes
2answers
591 views

Mount a Linux VMDK on Windows 2012 R2

I would like to mount a Linux VHD (ext3) file on Windows 2012 R2. So far, I have been using PowerShell to deploy Windows VMs and mount them locally to inject the unattend.xml file. I would like to ...
1
vote
0answers
366 views

“This Update is not applicable to your system”

When trying to install Windows Management Framework 5 on Windows 8.1 I'm getting this error: "This Update is not applicable to your system". According to this article it's due to a dependency on PS 4 ...
1
vote
1answer
17k views

How to create a PowerShell graphical interface?

I'm working on a project using PowerShell I would like to know what is the best way to create a PowerShell GUI?
2
votes
0answers
2k views

Unable to kill a process

With admin rights and Powershell, I want to kill a nasty process. PS D:\_prj> Get-Process someapp* | Stop-Process -Force (or without -Force). That works in 99% of cases. Unfortunately, sometimes ...
0
votes
1answer
379 views

Syncronize Hyper-V - Dual Boot Windows 10/Server 2012R2

On my PC I dual boot between Windows 10 and Server 2012R2. I keep the drive mappings exactly the same only flopping the C: and the Z: drive. I have Hyper-V role installed on both installations. I have ...
1
vote
1answer
491 views

Tail pattern with context in Powershell

If I tail a log like this: gc xxx.log -last 1 -wait | sls -patt 'Exception' -simple | % {write $_.Context.PreContext $_.Line $_.Context.PostContext} it works as expected spitting out lines ...
0
votes
1answer
157 views

Powershell 4.0 script to recycle MS Outlook in Win 2012 R2 Server?

I have a Win 2012 R2 Server that runs unattended with apps dependent on MS Outlook 2013 running. I would like to create a daily scheduled PowerShell script to gently close Outlook, create a backup of ...
2
votes
2answers
3k views

Using Advanced Parameter Sets in a Function with Multiple Unique Switches

I am using Powershell 4.0. I am attempting to write a cmdlet and in this cmdlet I would like to use Advanced Parameter sets to have certain options available based on what parameter(s) is/are chosen. ...
-1
votes
1answer
82 views

Regedit Don't open

I modified Registry key ProgramFilesDir to install more applications in External HDD but after reboot I can't open any application installed in my Pc , or any utilities of windows like Regedit / ...
0
votes
1answer
812 views

why remote powershell session dose not need password

why remote PowerShell session dose not need username and password? this is very terrible because I feel anybody can connect remotely to my server. I use negotiate authentication method and server ...
1
vote
0answers
1k views

PowerShell Remote Defrag

I have the following code that works fine on my Windows 7 computer: $Defrag = Get-WmiObject Win32_Volume -Filter "DriveLetter='c:'" -ComputerName "SRLVHOMAPP01" | Invoke-WmiMethod -Name Defrag But ...
4
votes
4answers
14k views

Test network ports faster with PowerShell

In Windows 8.1, the Test-NetConnection cmdlet is useful for checking the state of a network port on a remote system. However, it can be unnecessarily slow sometimes. I'd like to know if there's some ...
1
vote
1answer
4k views

Can't install PowerShell 4.0

I'm trying to install PowerShell 4.0 on a Windows 2008R2 server Installed Windows6.1-KB2819745-x64-MultiPkg.msu with no errors or warning But when I run up PowerShell and check the $host.version, it'...
0
votes
1answer
291 views

Can't get powershell to return where results from GCI using ACL

I'm trying to get Powershell to list files in a directory that are older than a certain date and match a certain user. I've got the below script so far which gives me all the files older than a ...
5
votes
3answers
3k views

Get-ChildItem | tree gives me a wierdly formatted tree

The following input: PS STG:\> Get-ChildItem | tree Gives me Folder PATH listing for volume Data Volume serial number is 6576-C540 D:. ÃÄÄÄAPK ÃÄÄÄAssets ³ ÃÄÄÄAnimations ³ ³ ...
14
votes
2answers
2k views

Why does running PowerShell change my console font?

I have a strange problem on my laptop - when I run Powershell within an existing console window, the font choice for the window changes. For example, this is cmd.exe immediately after opening the ...
2
votes
1answer
4k views

Invoke-Sqlcmd not working after PowerShell 4 install

I installed PowerShell 4 yesterday and ever since then, I get the error "The term 'Invoke-Sqlcmd' is not recognized as the name of a cmdlet, function". This has been working just fine for months ...
5
votes
2answers
2k views

Can the default PowerShell terminal keep a command history?

Is there a way to have PowerShell remember commands entered during the previous sessions? That is, after closing the window and opening it again, can PowerShell be setup to remember the commands?
261
votes
9answers
329k views

Native alternative to wget in Windows PowerShell?

I know I can download and install the aformentioned library (wget for Windows), but my question is this: In Windows PowerShell, is there a native alternative to wget? I need wget simply to retrieve ...