Hot answers tagged powershell
3
Not in exactly the same fashion that I am aware of. One option is to use pushd instead of cd. Then popd will take you back.
You could also change your profile so that whenever a new prompt comes up (basically whenever you hit enter). It would get the PWD and compare that to the previous one. If they are different, then put that value onto a stack. Then you ...
2
Here is a solution using a list of names:
$names = @('one.txt', 'two.txt', 'three.txt', 'four.txt', 'five.txt', 'six.txt', 'seven.txt', 'eight.txt', 'nine.txt', 'ten.txt')
$count = 0
foreach($file in (Get-ChildItem i:\temp | Sort-Object LastWriteTime | Select-Object -First 10)){
Rename-Item $file.FullName (Join-Path $file.DirectoryName $names[$count])
...
1
I think you need to get a non-click-to-run version of Word/Office.
From MS's Configuring a Computer to Develop Office Solutions:
Note: Visual Studio 2012 does not support creating Office solutions when the development computer has a version of Office 2013 or Microsoft Office 2010 that was delivered by means of Click-to-Run.
Also, as you've probably ...
1
PowerShell 3.0 has the new command Invoke-RestMethod:
http://technet.microsoft.com/en-us/library/hh849971.aspx
more detail:
http://www.discoposse.com/index.php/2012/06/30/powershell-invoke-restmethod-putting-the-curl-in-your-shell/
1
Actually, it is possible to use both the Start-Service and Stop-Service PowerShell commands on a remote machine (discussion on this here). I have tested this and confirmed that it works:
Start-Service -inputobject $(get-service -ComputerName SERVER_NAME -Name SERVICE_NAME)
Also, you could try wmic to stop the service. It does appear to wait for the ...
1
The beauty of powershell is that you get full-blown .NET objects that you can inspect. In the case of dates, powershell uses the DateTime class which exposes MOnth and Year properties that you can take advantage of:
gci "\\servername\sharename\foldername\subfoldername\*.zip" |
?{ $lwt = $_.LastWriteTime; ($lwt.Month -eq ((get-date).Month-1)) -and ...
1
dir is the old way for DOS / Windows, Powershell gives you get-childItem
You should identify the directory you want to look for your files on, and then do something like:
$myDir = "\\Server\Directory\"
get-ChildItem -Path $myDor | Foreach {
get-Acl $_
}
Only top voted, non community-wiki answers of a minimum length are eligible