Skip to main content

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
354 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,091
49 votes
7 answers
85k views

Show human-readable file sizes in the default PowerShell ls command

How can I modify the default ls (Get-ChildItem) in PowerShell so that it displays human-readable file sizes, like ls -h on a *nix machine? ls -lh does simple logic with the file size, so that it ...
Tom Mayfield's user avatar
  • 1,487
12 votes
5 answers
80k 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
11 votes
2 answers
6k views

Is there a way to run git within Powershell?

Is there a way to run git within Powershell? I have a Windows 7 box with msysgit. I'd like to have a single shell to also run all my git commands as well as play around with Powershell scripting.
spong's user avatar
  • 2,029
10 votes
1 answer
46k views

Running msiexec with PowerShell

I'm try to run msiexec in PowerShell but I keep getting an error message. If I run it from cmd then it's all fine. Can someone please let me know how I can run this command in PowerShell? This is ...
user630320's user avatar
9 votes
1 answer
39k views

NetBios lookup from command line/powershell in Vista

Am trying to resolve an IP address to its Netbios name via the command line or via powershell. the system I am using is Vista SP2 so I do not believe NBLookup.exe will work. are there any ...
user avatar
9 votes
3 answers
15k views

Using powershell call native command-line app and capture STDERR

I'm using a port of a cygwin tool on Windows which writes normal status messages to STRERR. This produces ugly output when run from PowerShell: PS> dos2unix.exe -n StartApp.sh StartApp_fixed.sh ...
yzorg's user avatar
  • 755
8 votes
4 answers
21k views

Is Windows PowerShell 2.0 installed by default on Windows 7?

http://msdn.microsoft.com/en-us/library/ff637750.aspx claims Windows PowerShell 2.0 needs to be installed on Windows Server 2008 and Windows Vista only. It is already installed on Windows Server ...
kenwarner's user avatar
  • 2,427
7 votes
3 answers
13k views

Where can I download Powershell 2.0 for Windows 7?

I have spent the better part of a day hunting the Internet looking forr a way to download Powershell 2.0 to my already Win7 environment. Windows 7 is supposed to come with PS 2.0 however - I have 1.0. ...
TxGeekGirl's user avatar
6 votes
2 answers
2k views

Any quick way to call a directory using an environment variable in Powershell

Say I have a user environment variable named p and it's value is the path where I store my projects. In Command Prompt you can use them to quickly access a particular directory from anywhere on the ...
dads's user avatar
  • 73
6 votes
2 answers
28k views

Powershell: Get inital character string from file name and create directory from string, then move files

I have a folder with the following file names: 00150005D201110172338427995.vpf 00150005D201110180005318058.vpf 00150013D201110180014448082.vpf 00150013D201110180022268098.vpf ...
JRG's user avatar
  • 61
6 votes
1 answer
7k views

WinRM - what it is and how to use it?

During installing updates I noticed 'PowerShell 2.0 and WinRM' update. Upon reading some Microsoft & Wikipedia pages I read that it is remote management system that runs on SOAP and that it is ...
Maja Piechotka's user avatar
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,740
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
  • 255
5 votes
1 answer
19k 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,769
4 votes
1 answer
376 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
4 votes
1 answer
6k views

Copying the timestamp from one file to another (using PowerShell 2.0 on Windows-7)

On my Android phone, it was configured to save pictures to the Phone-memory. I wanted to free up some memory in the phone, and since I have a 16GB uSD card, I: 1) copied all the pictures to my ...
Kevin Fegan's user avatar
  • 4,887
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.9k
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,171
3 votes
1 answer
3k views

How to start a Windows XP Virtual PC application using Powershell from Windows 7?

This is a shortcut target of an application I launch from Windows 7 that starts a program in Windows XP Mode. %SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\VMCPropertyHandler.dll,...
payling's user avatar
  • 185
3 votes
2 answers
22k 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
3 votes
2 answers
2k views

Where is Powershell 2.0?

I just uninstalled Powershell 1.0 and installed Powershell 2.0. Where are the Start Menu shortcuts?
Even Mien's user avatar
  • 389
3 votes
2 answers
2k 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
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
2 answers
593 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
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
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
  • 151
2 votes
2 answers
78 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.9k
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

problem powershell cant access to a network share

I use PowerShell to check if any ports are open on my computers. I have eight Windows Server 2008 R2 machines and run the following script: $localhost = get-content env:computername foreach($port in ...
alex's user avatar
  • 131
2 votes
1 answer
8k 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
2 votes
1 answer
11k views

How can I sort objects by third column in Powershell?

I've a text file like this: 4108689096 2531 ./ssss/132432.odt 481446057 2293 ./abc/a.txt 3157353085 1096 ./dsjvbjf/c.docx 653380669 1824 ./bcd/x.avi And I'd like to achieve in Powershell to sort the ...
szantaii's user avatar
  • 123
2 votes
2 answers
60 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
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
2 votes
0 answers
283 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
1 vote
1 answer
11k 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
  • 575
1 vote
2 answers
846 views

Windows PowerShell ISE doesn't import PSCX 2.0 module

i am using Powershell 2.0 with the PSCX 2.0 module. When writing PS scripts inside Windows PowerShell ISE no Cmdlets from the PSCX module are availible. For example running "Get-DriveInfo" from ...
Alexander's user avatar
  • 356
1 vote
2 answers
5k views

can I get powershell to properly copy multiline text like Bash in Ubuntu does?

I use an Ubuntu VM at home for Rails development and I've gotten a bit spoiled by Bash. When I copy multiline text from Bash, it seems like it's pretty good about knowing that text is single line or ...
jcollum's user avatar
  • 5,183
1 vote
2 answers
3k views

Default Encoding in Windows PowerShell 2?

What is the default encoding (charset) used by PowerShell? I have figured out it is not UTF-8, but how can I know what encoding is used then instead? Thanks!
jsalonen's user avatar
  • 9,091
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
1 vote
1 answer
759 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
920 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
1 vote
1 answer
687 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
304 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.9k
1 vote
1 answer
1k views

How to set and print environment variable in Power Shell?

I work on Windows 7 and I wont to know how to set and print environment variable in Power Shell (for example $PATH)?
Narek's user avatar
  • 1,441
1 vote
0 answers
4k 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
  • 131
1 vote
1 answer
704 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
  • 113
1 vote
1 answer
2k 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
1 vote
2 answers
1k views

How to start/stop service on a remote computer with an out of sync clock

I'm working in a MS Windows Domain. I'm trying to centrally (remotely) start and stop the W32Time service for a certain amount of time (to disable Time Server update e.g for two hours) then remotely ...
Andrea Colleoni's user avatar
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