Skip to main content

Questions tagged [powershell-4.0]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4 votes
1 answer
369 views

Don't want to display WARNING: ACTIONS REQUIRED: while running powershell script

I have written bitlocker code to backup key after old key has been shared with user. My requirement is that don't want to display WARNING: ACTIONS REQUIRED: while running script $BLV = Get-...
Suraj Kumar's user avatar
1 vote
1 answer
427 views

validate particular column and its value using powershell

Validate Status Column using powershell. If any status column contain Not-compliant then overall status column needs to be displayed not-compliant. Attached data for your reference. Trying below code ...
Suraj Kumar's user avatar
0 votes
1 answer
376 views

Export data to excel by creating instance of the Excel.Application object in PowerShell

Currently i'm using ImportExcel module to fetch data from multiple csv file and export in single excel file. But due to network restriction from this month I am not able to install importexcel module. ...
Suraj Kumar's user avatar
1 vote
1 answer
756 views

Copy files and only the parent folder the file resides

Copying files but not all the folders, just the one parent/relative folder in which contains the files. Folder and Files structure: ExcelData (Folder) a. File1.xlsx b. File2.xlsx c. File3.xlsx d. ...
Suraj Kumar's user avatar
2 votes
1 answer
2k views

Powershell script to capture Screenshot

Don't want to use third party tool and module. $ie = New-Object -ComObject InternetExplorer.Application $ie.Visible = $true $ie.Navigate("https://www.google.com") $ie.FullScreen = $true ...
Suraj Kumar's user avatar
0 votes
1 answer
116 views

Exception calling "CopyFolder" with "4" argument(s): "The 'destUrl' argument is invalid."

I'm trying to copy local drive folder to targeted folder in online one drive but getting above error. Below is the code tried: - #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\...
Suraj Kumar's user avatar
0 votes
1 answer
202 views

Run-SCCMClientAction : Connecting to remote server DD4 failed with the following error message

I am running below script on my system to perform all sccm client actions trigger and getting below error. Run-SCCMClientAction : Connecting to remote server DD4 failed with the following error ...
Suraj's user avatar
  • 25
1 vote
1 answer
919 views

Export-CSV column/row value as filename

I've got a bunch of csv files that each look like this: DD-L-1_test.jaun.Csv Parameter, Version, Status OS, 21H2, Compliant Chrome, 107.1.1, Compliant DD-L-2_test.smith.Csv Parameter, Version, Status ...
Suraj's user avatar
  • 25
0 votes
1 answer
603 views

Form with Input Window, where a mechanism shall check if data has been entered

I need it to not close when user press enter or exit so that it mandate for user to make entry for all three box. I am new to powershell so I might be sounding akward but I can't find a good solution ...
Sagar Mahto's user avatar
2 votes
2 answers
13k views

PowerShell select-object Expand Property For multiple values

How can I Filter Files Name and Complete Files Path Using powershell select-object expand property here is files in partition Mode LastWriteTime Length Name ---- -----...
Sadam's user avatar
  • 144
2 votes
1 answer
8k views

How to merge multiple excel files and update the merged file's worksheet names as excel files?

Can somebody please help me to resolve this. This is my requirement: I have few excel files (It will vary) in a folder D:\Script\Test The name of the files are ExcelA, ExcelB, ExcelC etc It has ...
Vimal VV's user avatar
0 votes
0 answers
100 views

'Foreach Recipient in Recipients' not work correctly in Powershell

The recipients of a mail in Outlook 2010 are as follow. I tried to use foreach to delete all of the existing recipients but it failed to delete all(but deleted some). Also the dummy Write-Host (the ...
Richard Chung's user avatar
-1 votes
1 answer
62 views

How to add SAMAccount to results?

Stuck on how to add SAMAccounts (AD usernames) to the results, can anyone help? Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | where {$_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_....
Top's user avatar
  • 11
0 votes
1 answer
2k 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 ...
comp.sci.intern's user avatar
3 votes
3 answers
4k 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 ...
SOSidb's user avatar
  • 533
3 votes
2 answers
2k 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 ...
monojohnny's user avatar
1 vote
1 answer
2k 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 ...
user691963's user avatar
4 votes
2 answers
9k 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 ...
G Raybin's user avatar
0 votes
2 answers
1k 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 ...
user01230's user avatar
1 vote
0 answers
523 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 ...
Naeem Sarfraz's user avatar
1 vote
1 answer
19k 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?
Hkm Mahjoub's user avatar
3 votes
0 answers
3k 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 ...
Leśny Rumcajs's user avatar
0 votes
1 answer
423 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 ...
David Johnson's user avatar
1 vote
1 answer
2k 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 ...
gordy's user avatar
  • 233
0 votes
1 answer
333 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 ...
Kenneth Berg's user avatar
2 votes
2 answers
5k 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. ...
cyborgcommando0's user avatar
-1 votes
1 answer
94 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 / ...
Phenix_dz's user avatar
  • 105
0 votes
1 answer
1k 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 ...
sorosh_sabz's user avatar
1 vote
0 answers
2k 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 ...
The Woo's user avatar
  • 477
10 votes
9 answers
67k 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 ...
Iszi's user avatar
  • 13.9k
1 vote
1 answer
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'...
SteveC's user avatar
  • 2,154
0 votes
1 answer
444 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 ...
Rossaluss's user avatar
5 votes
5 answers
7k 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 ³ ³ ...
aPerfectMisterMan's user avatar
25 votes
2 answers
5k 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 ...
Bevan's user avatar
  • 2,733
2 votes
1 answer
6k 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 ...
Russ's user avatar
  • 155
6 votes
2 answers
3k 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?
Louis Waweru's user avatar
  • 24.8k
353 votes
12 answers
622k 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 ...
jsalonen's user avatar
  • 9,081