Commit graph

2914 commits

Author SHA1 Message Date
dependabot[bot]
a25129c392 Build(deps): Bump NJsonSchema from 9.13.17 to 9.13.18 (#8881) 2019-02-13 10:10:44 -08:00
Ilya
ff3edaa2e3
Fix lgtm issues (#8843)
Add some null checks
Remove unused code
2019-02-13 16:51:05 +05:00
Tom Hvitved
5f59a9dfef Fix length check in PSSnapinQualifiedName.GetInstance() (#8837) 2019-02-08 23:50:19 +05:00
dependabot[bot]
98c360205f Build(deps): Bump Microsoft.ApplicationInsights from 2.9.0 to 2.9.1 (#8848)
Bumps [Microsoft.ApplicationInsights](https://github.com/Microsoft/ApplicationInsights-dotnet) from 2.9.0 to 2.9.1.
2019-02-08 10:22:11 -08:00
Steve Lee
5ece96a37f Don't use Win32 native APIs on non-Windows for crypto of secure string over remoting (#8746)
Remoting relies on Windows native crypto APIs to pass a secure string.  Of course these APIs don't work on non-Windows.  However, the remoting code does not expect this to fail so ends up in a hang waiting for an event that never happens.

Have not figured out how to return an error to the user in the case `Get-Credential` is called within a PSSession.  Currently it just quietly closes the remote connection.  @PaulHigin can you give a pointer to where this code would exist?  Debugging the current code, it has a bunch of error handlers which just result in the pssession being closed and not sure where throwing is appropriate.

Fix https://github.com/PowerShell/PowerShell/issues/8723

## PR Context  

Fix is to provide implementations of the Win32 native pinvoke apis that throw an exception.  The reason to do it this way is that there's a bunch of code that calls some of the APIs of the wrapper .Net class to setup structures that eventually get passed to the win32 api.  Throwing in the managed class causes other things to fail early that should work on non-Windows.
2019-02-07 15:36:13 -08:00
Steve Lee
26a58670c1 Enable creating relative symlinks on Windows with New-Item (#8783) 2019-02-07 11:44:23 -08:00
Bruce Payette
6bc6257a55 Allow .exe files to be used as IL binary modules (#7281)
Fix for #6741 Allow .exe files to be used as binary modules. Basically anywhere a .dll could be used with modules, you can now use a .exe file. Also did a little clean up, replacing constant strings with the StringLiteral values instead.
2019-02-07 11:24:06 -08:00
Staffan Gustafsson
ec88045fee Reduce string allocations when formatting file system objects. (#8831)
* Reduce string allocations when formatting file system objects by caching FullName.
* Clear cache FullName when the module changes.
2019-02-07 09:23:26 +05:00
Steve Lee
d9be6483f6 Move CommandNotFoundException suggestion to an experimental feature (#8805) 2019-02-06 13:59:14 -08:00
Reece Dunham
0606c27cb0 Fix many instances of CodeFactor style issue A single-line comment must not be followed by a blank line (#8825) 2019-02-05 09:47:19 -08:00
Joel Sallow (/u/ta11ow)
130298bfae Parse numeric strings as numbers again during conversions (#8681) 2019-02-04 12:22:05 -08:00
Stéphane BARIZIEN
d032cb2c87 Expose file attributes of OneDrive placeholders (#8745) 2019-02-04 12:11:46 -08:00
dependabot[bot]
249c78eefc Build(deps): Bump Microsoft.ApplicationInsights from 2.8.1 to 2.9.0 (#8807) 2019-02-01 12:36:43 -08:00
dependabot[bot]
f06ebb692a Build(deps): Bump PackageManagement from 1.2.4 to 1.3.1 in /src/Modules (#8800)
Updated the wxs file.
2019-01-31 16:57:50 -08:00
Steve Lee
313c8c06a1 Enable Write-Information to accept $null (#8774) 2019-01-31 13:16:34 -08:00
Joshua T
c935bce1ac Adding parameter "ReplyTo" to Send-MailMessage (#8727) 2019-01-30 16:33:15 -08:00
pougetat
1d7651f233 Fix Get-Help PSTypeName issue with -Parameter when only one parameter is declared (#8754) 2019-01-30 08:55:33 -08:00
Steve Lee
3e8f85a682 Enable catching NotImplementedException when calling into RawUI for members that are not implemented 2019-01-28 12:13:15 -08:00
Joel Sallow (/u/ta11ow)
db1b309800 Correctly Report impact level when SupportsShouldProcess is not set to 'true' (#8209)
Major changes are:
- Make all commands return 'ConfirmImpact.None' if `SupportsShouldProcess` is not set to `true`.
- Update some cmdlets to explicitly use `ConfirmImpact.Low`.
- Update `DefaultCommands.Tests.ps1` to test for 'ConfirmImpact' level.
2019-01-26 03:12:00 -08:00
Mark Kraus
ff83206e1c Fix Request Charset Issues in Web Cmdlets (#8742)
Instantiating a new MediaTypeHeaderValue object fails when the -ContentType parameter includes a charset such as application/json; charset=utf-8. This makes it impossible to set the content encoding on web requests. Moving to Parse() ensures we actually get a proper MediaTypeHeaderValue when the charset is present, thus allowing users to set their request encoding via proper -ContentType values.
2019-01-26 12:48:47 +05:00
Aditya Patwardhan
6ccbebda27 Improve check for developer mode by checking minimum required build number (#8749)
* Improve check for developer mode by checking minimum required build number

The test would fail if the developer mode is enabled but the machine has an older build than the minimum required build.
The change adds a check for the build version in the test.

* Update test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1
2019-01-25 13:14:29 -08:00
Dongbo Wang
12547c01e8 Add complete xml docs for ConvertToJsonContext constructors (#8737) 2019-01-25 12:02:41 -08:00
Dongbo Wang
c35fd70b15 Simplify the declaration of new experimental features (#8726) 2019-01-25 11:57:28 -08:00
dependabot[bot]
28042f3f44 Build(deps): Bump NJsonSchema from 9.13.16 to 9.13.17 (#8747)
Bumps [NJsonSchema](https://github.com/rsuter/NJsonSchema) from 9.13.16 to 9.13.17.
- [Release notes](https://github.com/rsuter/NJsonSchema/releases)
- [Commits](https://github.com/rsuter/NJsonSchema/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-25 19:36:39 +05:00
Sergey Vasin
a9841d98fa Make Join-String -InputObject 1,2,3 result equal to 1,2,3 | Join-String result (#8611)
Make `Join-String -InputObject 1,2,3` result equal to `1,2,3 | Join-String` result.

Fix #8610
2019-01-24 12:53:37 -08:00
xtqqczze
863528881f Use https in URLs where available (#8622)
Use https in URLS across the repository where the domain serves content by https.
2019-01-24 12:50:11 -08:00
dependabot[bot]
4f3f2fb32e Build(deps): Bump NJsonSchema from 9.13.15 to 9.13.16 (#8732)
Bumps [NJsonSchema](https://github.com/rsuter/NJsonSchema) from 9.13.15 to 9.13.16.
- [Release notes](https://github.com/rsuter/NJsonSchema/releases)
- [Commits](https://github.com/rsuter/NJsonSchema/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-24 19:12:06 +05:00
Paul Higinbotham
4a1fc4b382 Remove AMSI unitialized assert and replace with call to uninitialize (#8713) 2019-01-23 13:58:23 -08:00
Steve Lee
7e2cd7954f Add the experimental feature for creating 'Temp:\' drive when FileSystemProvider initializes (#8696)
Adds Experimental Feature called `PSTempDrive` that, if enabled, creates a PSDrive called `Temp:` that maps to `[System.IO.Path]::GetTempPath()`.
2019-01-23 13:53:04 -08:00
Dongbo Wang
c606b1ca37 Refactor ConvertTo-Json to expose JsonObject.ConvertToJson as a public API (#8682)
We have the public API `JsonObject.ConvertFromJson` to convert from JSON string in the PowerShell context. It would be good to have a public API for conversion to JSON. This PR refactors the `ConvertTo-Json` cmdlet to move the core implementation to `JsonObject.ConvertToJson`, and make `ConvertTo-Json` call that public method.

This would help the Azure Function PowerShell worker. Currently, we depends on [calling the cmdlet](729710d259/src/PowerShell/PowerShellManager.cs (L198-L205)) to convert object to JSON which is expensive. Once we have the public method `JsonObject.ConvertToJson` exposed, we can call the API directly to avoid a command invocation.
2019-01-23 10:39:12 -08:00
Steve Lee
f7c25e8f7c Update code to use single method to check if path is UNC (#8680)
update all checks if path is unc to one method
2019-01-23 09:37:45 -08:00
dependabot[bot]
c955f313e4 Build(deps): Bump Microsoft.PowerShell.Native (#8712) 2019-01-22 14:35:36 -08:00
Mark Kraus
2dd549e34b Fix Code Page Parsing Isssue in Invoke-RestMethod (#8694) 2019-01-22 10:45:40 -08:00
Mark Kraus
67004aa224 Fix expect 100-continue Issue with Web Cmdlets (#8679)
Web Cmdlets will no longer forcibly remove Expect: 100-continue from web requests.
This was a legacy setting that needed to be there because of platform differences that have since been resolved in CoreFX.
2019-01-19 11:16:18 +05:00
Joel Sallow (/u/ta11ow)
631833cd50 Cleanup Format-Hex (#8683) 2019-01-19 00:33:36 +05:00
Michael Klement
20919ee793 Allow 'name' as an alias key for 'label' in ConvertTo-Html, allow the 'width' entry to be an integer (#8426) 2019-01-18 11:02:22 -08:00
Mathias R. Jessen
59a3696f70 Allow user-specified underlying type for enums (#8329)
Fix #8028 

This change adds support for specifying the underlying type for an enum:

```powershell
enum MyEnum : long 
{
  A = 0x0FFFFFFFFFFFFFFF
  B
}
# or
enum MyByte : byte 
{
  A = 0x01
  B = 0x02
  C = 0x03
  D
}
```
2019-01-17 14:22:10 -08:00
dependabot[bot]
f49af36670 Build(deps): Bump NJsonSchema from 9.13.14 to 9.13.15 (#8671)
Bumps [NJsonSchema](https://github.com/rsuter/NJsonSchema) from 9.13.14 to 9.13.15.
- [Release notes](https://github.com/rsuter/NJsonSchema/releases)
- [Commits](https://github.com/rsuter/NJsonSchema/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-17 21:49:19 +05:00
pougetat
4858afb613 Resolve :PAGER' if its path contains spaces (#8571) 2019-01-16 15:14:44 -08:00
Steve Lee
a04f6940dd Handle case where applocker test script fails to delete (#8627)
One reported case where during applocker policy check, the test script that is created cannot be deleted because something else (malware scanner?) has a lock on the file.  This results in an exception being thrown in finally block which ultimately causes PowerShell to crash due to the unhandled exception.  Fix is to wrap the deletion in the finally block with try..catch and ignore any exceptions and leave the temp file.

TFS:20156282
2019-01-16 15:00:37 -08:00
Ilya
782ef99465
Add support enum and char types in Format-Hex cmdlet (#8191) 2019-01-16 16:58:22 +05:00
Kirk Munro
41d9667307 Add -Stable to Sort-Object and related tests (#7862) 2019-01-15 17:14:39 -08:00
Aditya Patwardhan
be4b82c730
Add function to create a framework dependent package dotnet-sdk containers (#8644) 2019-01-15 16:28:52 -08:00
Sergey Vasin
279993bf39 Change Get-Help cmdlet -Parameter parameter so it accepts string arrays. (#8454) 2019-01-15 16:25:49 -08:00
Dongbo Wang
c2dfae8ccb Fix 'FixupFileName' to not load resolved assembly during module discovery (#8634) 2019-01-15 16:22:25 -08:00
dependabot[bot]
cd75f18b67 Build(deps): Bump NJsonSchema from 9.13.13 to 9.13.14 (#8648) 2019-01-15 14:47:14 -08:00
dependabot[bot]
bcae2d7713 Build(deps): Bump PowerShellGet from 2.0.3 to 2.0.4 (#8649) 2019-01-15 14:46:30 -08:00
dependabot[bot]
bfb219c747 Build(deps): Bump Markdig.Signed from 0.15.6 to 0.15.7 (#8637)
Bumps [Markdig.Signed](https://github.com/lunet-io/markdig) from 0.15.6 to 0.15.7.
- [Release notes](https://github.com/lunet-io/markdig/releases)
- [Changelog](https://github.com/lunet-io/markdig/blob/master/changelog.md)
- [Commits](https://github.com/lunet-io/markdig/compare/v0.15.6...v0.15.7)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-14 17:19:02 -08:00
Steve Lee
c3cb6df809 Update 'CommandNotFound' fuzzy suggestion to only return unique results (#8640) 2019-01-14 14:28:15 -08:00
Jani
812456f84c Improve Start-Sleep cmdlet to accept fractional seconds (#8537) 2019-01-14 10:04:44 -08:00