Stack Exchange Network

Stack Exchange network consists of 175 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-2.0]

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

270
votes
10answers
335k 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 ...
23
votes
4answers
33k 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 ...
11
votes
2answers
3k 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.
10
votes
1answer
29k 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 ...
8
votes
4answers
20k 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 ...
7
votes
3answers
10k 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. ...
7
votes
4answers
41k 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 ...
7
votes
1answer
29k 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 ...
6
votes
2answers
19k 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 ...
6
votes
1answer
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 ...
6
votes
2answers
10k 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 ...
5
votes
2answers
1k 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 ...
5
votes
1answer
11k 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 ...
4
votes
3answers
30k 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 ...
4
votes
0answers
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 ...
3
votes
1answer
2k 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,...
3
votes
2answers
2k views

Where is Powershell 2.0?

I just uninstalled Powershell 1.0 and installed Powershell 2.0. Where are the Start Menu shortcuts?
3
votes
2answers
1k 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:/...
3
votes
1answer
4k 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 ...
2
votes
2answers
181 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 ...
2
votes
2answers
72 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 -...
2
votes
1answer
4k 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 ...
2
votes
1answer
5k 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 ...
2
votes
1answer
10k 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 ...
2
votes
1answer
4k 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) ...
2
votes
1answer
7k 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 ...
2
votes
2answers
50 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 ...
2
votes
0answers
257 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 ...
1
vote
1answer
2k 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-...
1
vote
1answer
6k 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 ...
1
vote
2answers
728 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 ...
1
vote
2answers
2k 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!
1
vote
1answer
303 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 ...
1
vote
1answer
142 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 ...
1
vote
1answer
370 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)?
1
vote
0answers
1k 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....
1
vote
0answers
314 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 ...
1
vote
0answers
2k 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 ...
1
vote
1answer
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-...
1
vote
2answers
576 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 ...
0
votes
1answer
6k 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 ...
0
votes
1answer
4k 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 ...
0
votes
2answers
2k 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 ...
0
votes
2answers
3k views

List ACL with ACE in the proof in POWERSHELL?

I can list acl from an OU with Get-ACl cmdlet but I need to see the permission entries like we can see in : OU properties -> Security Tab -> Advanced -> View with Active Directory Users and Computers ...
0
votes
1answer
2k 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 ...
0
votes
3answers
734 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 ...
0
votes
1answer
2k views

Setting recycle properties on IIS7 App Pools using powershell 2.0

I am trying to set the current properties using powershell disallowRotationOnConfigChange disallowOverlappingRotation I do this with the following code $appPools = Get-childItem IIS:\AppPools ...
0
votes
1answer
79 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 ...
0
votes
1answer
92 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 ...
0
votes
0answers
34 views

Exclude server name containing Test

I have a script to extract list from vCenter on VMware Tools status daily as below. But It contains also Servers which was meant for Testing where its servers name contain Server-Name-TEST. How can I ...