Questions tagged [powershell-2.0]

Microsoft’s command-line scripting language. V 2.0, which was introduced in Windows 7 and Server 2008, features remoting.

Filter by
Sorted by
Tagged with
0 votes
0 answers
163 views

Upgrade powershell version 2.0 to version 4.0+ using cmd or powershell

I have a problem, I work in a large organization we have several computers with windows 7 and many of them are very old versions, and come with a powershell 2.0. I was creating some scripts to solve ...
user avatar
4 votes
1 answer
282 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
326 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
1 vote
1 answer
134 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
597 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
1 vote
1 answer
1k 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
98 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
0 answers
153 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
784 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
364 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
0 votes
1 answer
877 views

powershell for diskpart utility in windows

I want to avoid using command prompt for diskpart utility but want to know if there is any alternate available in powershell for diskpart to handle windows Dynamic disks ?
user1670527's user avatar
0 votes
1 answer
4k views

Disable PowerShell v2 via GPO

I'm trying to disable the old v2 version of PowerShell via GPO but have not been successful. I have tried everything, to run a Scheduled Task (running a PowerShell script which command inside DOES ...
sysadmin0101's user avatar
0 votes
0 answers
987 views

uninstalling the chrome using powershell script

I am trying to uninstall google chrome using powershell script but it shows me a popup to choose uninstall/cancel. How can i supress this by choosing uninstall button? Set-Location 'path\to\my\chrome' ...
ven's user avatar
  • 1
0 votes
1 answer
218 views

PowerShell 2 on Windows Server Core

I have two machines, Windows Server Core 2016 and Windows 10 Enterprise. From cmd, executing PowerShell.exe and then $PSVersionTable.PSVersion outputs version 5.1 for both machines. From cmd, ...
Shelby115's user avatar
  • 101
3 votes
2 answers
1k views

issue with robocopy on copying files from source to destination of longpath

I am using robocopy $source $destination /MIR, the thing is it does copy files in sync with the source but skippnig the files and directories from source which are having long path names. i would ...
E PSVP LIFE's user avatar
0 votes
1 answer
2k views

How do I write this powershell 2.0 command, which creates a scheduled task, to run another powershell command?

For all intents and purposes, I am a novice with PS. The command I'd like to run (it works when run manually) is: (I realize parts are probably redundant) Start-Process -WindowStyle hidden "$...
Will's user avatar
  • 45
0 votes
1 answer
2k views

Power Shell Stop-Process throwa error that the process does not exist

I am trying to execute the following script $WonderwareProcess = Get-Process -Name "Studio Manager" Write-Output $WonderwareProcess Stop-Process -Name $WonderwareProcess -Force $Result = Get-Process |...
TheColonel26's user avatar
-1 votes
1 answer
41 views

I as the user, am trying to add myself to local administrator group on the box

so im working out an exercise and wanted to ask what possible avenues there were to do this (preferably through powershell v2) I have tried the following from a batch file casually written: C:\...
jason's user avatar
  • 1
-1 votes
1 answer
489 views

Struggling to get Skype to download over Powershell 2.0

I'm having difficulty with a batch file I created to aid in downloading, and updating Skype. The part that isn't working is the bit which downloads Skype itself. Most of the machines I'm supporting ...
user avatar
0 votes
1 answer
93 views

power shell + how to capture the names in file before separator to variable

in file.info we have the following structure kdme:424324 fejwde:3425 kededmrf:132456 edkmedefrf:45 . . . how to set the variable - param with all names - kdme fejwde kededmr edkmedefrf expected ...
King David's user avatar
0 votes
1 answer
253 views

power shell + match exactly the first field and capture the second field after separator

we have the following file ( files.sum ) the first field is the name of the file the second field is the seprator the thired feald is the sum configuration.txt:2327432786 config.csv:458349573 ...
King David's user avatar
1 vote
0 answers
3k views

copy file from a remote PC by means of Powershell using UNC Path

I need a way to copy file to local disk from a remote PC using Powershell v2.0, trying with admin rights of that remote PC. By means of below cmdlet we can copy a file: Copy-Item -Path C:\somefile....
Nani's user avatar
  • 111
2 votes
2 answers
527 views

How can a (PowerShell) script determine it is running at startup?

I'm building a PoSh startup script that initializes a couple scheduled tasks. One task is triggered at user logon and another is triggered on idle. Both tasks run the script again. Only the first ...
Teknowledgist's user avatar
-2 votes
1 answer
645 views

How and where to upload/download a file with cmd.exe/PowerShell

I wanted to download files via CMD, and the first way I discovered was FTP. I rent a server and everything worked. The problem is that it takes kinda long to type in the credentials. After some ...
c0ntriX's user avatar
  • 17
1 vote
1 answer
627 views

Why do I need to escape the last single quote in this Powershell here-string?

According to Powershell "about quoting rules": A here-string is a single-quoted or double-quoted string in which quotation marks are interpreted literally. However the following here-string ...
Bram's user avatar
  • 622
1 vote
1 answer
652 views

Powershell recursive filename read and rename

i have downloaded from my ftp server a directory tree using wget and forcing ascii encoding so now i hve a lot of folders and files names something like "foo%C3%BC" (some of the files/folders already ...
John Doe's user avatar
  • 111
2 votes
2 answers
58 views

Trouble working with Github

In order to learn from other and better programmers how to write good code I decided to install Github Desktop. It was installed-no problem, but, on opening the Git shell that comes with the ...
yasaaMoin's user avatar
2 votes
1 answer
9k views

What is the PowerShell command equivalent to selecting "Sleep" from the Win7 menu?

What PS command(s) do I use to put my lappy to sleep like the description when I hover the mouse over the Windows menu "Sleep" option: Keeps your session in memory and puts the computer in a low-...
MmmHmm's user avatar
  • 758
2 votes
0 answers
4k views

Proper Powershell 2.0 installation on Linux with wine 1.7.29

Despite the bad rating on WineHQ I attempted to install Powershell 2.0 using wine 1.7 on Debian Jessie, and after a registry "fix", it runs without the previous startup errors. I had followed the ...
Alex Stragies's user avatar
0 votes
1 answer
167 views

Powershell command works from cmd but not run

I am trying to bind this command to a key (MS Keyboard Center): powershell -Command "(new-object system.Net.WebClient).DownloadFile('http://spotify.hum?command=play','test')" If I run this from an ...
Paul's user avatar
  • 59.6k
1 vote
1 answer
10k views

Powershell Enter-PSSession use current credential

I want to use Windows Powershell to start up a VirtualBox VM and then Enter-PSSession to manage the machine on an automated nightly system, which means I will be asleep when this is happening and not ...
Void Star's user avatar
  • 525
5 votes
2 answers
3k views

Archive of Microsoft's Powershell 2.0 Documentation?

When looking up information on a specific cmdlet built into Powershell on Microsoft Technet, you can choose between version Powershell versions 3.0, 4.0, and 5.0. See this page for an example - https:/...
romellem's user avatar
  • 245
3 votes
2 answers
20k views

Restart a computer at a given time with PowerShell

I'm looking for a way to restart a computer with PowerShell (Restart-Computer), at a given time (Example: 03:00AM). The PS-Script itself will run at a random time, when the user executes it, so it's ...
Jente's user avatar
  • 396
0 votes
1 answer
6k views

How to unblock file via WindowsPowerShell?

I am using windows Vista buissnes 32 bit. When I try to execute command : dir *.* -Recurse | Unblock-File I am getting : The term 'Unblock-File' is not recognized as the name of cmdlet, fun.. I am ...
malakrsnaslava's user avatar
1 vote
1 answer
1k views

Powershell 2.0 Enter-PSSession cannot get New-PSDrive working

I have a remote computer which I can Enter-PSSession successfully. When I execute: New-PSDrive -Name "G" -PSProvider Filesystem -Root '\\fileserver\apps\etc' I get the following error: New-...
LMZ's user avatar
  • 11
5 votes
1 answer
18k views

How can I use PowerShell to parse filenames and rename them?

I've got a project analyzing logfiles. Someone, in their infinite wisdom, is naming the logfiles MM-DD-YYYY-HH-MM.LOG (e.g., 10-31-2012-18-00.LOG for 6:00pm on October 31, 2012). My first order of ...
dwwilson66's user avatar
  • 1,719
2 votes
0 answers
274 views

Change State of Windows Update- Local Group Policy Editor without UI?

In windows server 2012,for this manual step how can i do from script, start>run>gpedit.msc>administrative Components>Windows>Windows update In that 1) Do not Display " Install ...
user241990's user avatar
12 votes
5 answers
77k views

Powershell script to list scheduled tasks on remote systems

I want to write a PowerShell script that lists all Scheduled Tasks on remote systems, and includes the user account which will be used to run each task. The local system is running Windows 7, with ...
Ob1lan's user avatar
  • 1,906
2 votes
1 answer
4k views

Windows Batch File (WMI) - taskkill process based on memory usage

Is there a way using WMIC, bat files, or powershell, to kill a task with a particular task name if the amount of virtual memory the process is using is above a certain limit? Specifically I want to ...
Darwyn's user avatar
  • 141
0 votes
1 answer
2k views

Can't run start-process command

I'm trying to run a command found in this answer. The command is start /w %SystemRoot%\system32\pkgmgr.exe /ip /m:Windows6.1-KB2506143-x86.cab Trouble is, it doesn't work for me. Indeed, it returns ...
merours's user avatar
  • 57
0 votes
1 answer
9k views

PowerShell “.count” method causing incorrect processing

I am creating an array in PowerShell that doesn’t always contain data (sometimes it is empty). I need to verify that the array contains data before trying to do anything to the array objects. When I ...
SOSidb's user avatar
  • 533
0 votes
1 answer
1k views

Powershell function with Parameters throwing null exception

This script is throwing a null exception and I am not certain why that is the case... Function StopServices{ Param ( $ServiceName, $Remoteserver ) write-host($...
SoftwareSavant's user avatar
1 vote
1 answer
268 views

PowerShell reports missing method, when method exists

I've had a problem recently with PowerShell reporting that a method does not exist on an object, while Get-Member reports that it does. This doesn't happen with all methods, but I have had it happen ...
Iszi's user avatar
  • 13.7k
5 votes
3 answers
38k views

How to run "winrm quickconfig" on all LAN computers remotely

I want to start doing my remote LAN work using powershell, but it seems I need to run winrm quickconfig on all LAN computers before I can remotely connect to them. How can I run that command on all ...
oshirowanen's user avatar
  • 1,710
4 votes
0 answers
1k views

How can I easily split a CSV into two Excel worksheets with PowerShell? [closed]

I recently found out that PowerShell can be used to write Excel documents. The first use I thought of for this was to (at least partially) automate parsing of some CSV reports that I regularly have to ...
Iszi's user avatar
  • 13.7k
2 votes
2 answers
77 views

Access the user's selection from a previous cmdlet

I'm writing a script that I want to be able to react depending on the user's answer to a confirmation prompt that is part of a cmdlet being run in the script. For example: Stop-Process -Name notepad -...
Iszi's user avatar
  • 13.7k
0 votes
1 answer
605 views

Cannot install Windows Powershell on Vista64

I am desperately trying to install Powershell 2.0 on my Windows Vista 64 system. I downloaded KB968930 like a hundred times but when I start it it always says that I cannot use it with my system. ...
Simon Linder's user avatar
3 votes
3 answers
2k views

How to remap shortcut in Powershell

I want to remap the shortcut in powershell, for example, I'd like to use Ctrl + a to make cursor at beginning of line, Ctrl + e to make cursor at the end of line, etc. I searched the method in Google ...
Marslo's user avatar
  • 1,141
2 votes
1 answer
5k views

PowerShell touch all files newer than

I have found the following question on ServerFault: Windows recursive touch command Which partially answers my question with this answer: Windows recursive touch command However, I would like to ...
atwright147's user avatar
2 votes
1 answer
7k views

Powershell Select-String to remove a string line from a variable if matched

I am trying to do the following: Look for a file in a folder which has been modified in the past 24 hours Find a specific section of the file Remove lines from the section matching specific string(s) ...
user195234's user avatar