You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now it's just a wrapper for [system.guid]::NewGuid.
It would be good to add new parameters: -Empty to get [system.guid]::Empty -Guid as [string] (with ValueFromPipeline) -NewGuid as default
I disagree about adding -Empty and -Guid. Neither seem to fit with the New verb, and converting a string to a Guid happens where necessary automatically, at least I think it does.
Some applications use GUID as a unique identifier. In this case, the identifier is a string. So really, we can get a stream of strings (ex. from logs), that we want to convert to [guid]. And yes this is more for ConvertTo-Guid but I looked through New-* cmdlets and many of them do a similar operation (string -> object). Most likely the new ConvertTo-Guid cmdlet is redundant and perhaps it would be better to make the GUID parameter.
Actually I'm surprised that New-Guid has appeared. But if it is, then it is logical to realize a full set of features including Empty. It is also used by some applications (ex. SCCM).
If we do not do Guid and Empty and do not use pipeline there is an option to make a breaking change and remove New-Guid because there is [guid].
Activity
iSazonov commentedon Nov 21, 2016
Now it's just a wrapper for
[system.guid]::NewGuid.It would be good to add new parameters:
-Emptyto get[system.guid]::Empty-Guidas [string] (withValueFromPipeline)-NewGuidas defaultpowercode commentedon Nov 21, 2016
Starting work.
@powershell/powershell assignment?
lzybkr commentedon Nov 21, 2016
I disagree about adding
-Emptyand-Guid. Neither seem to fit with theNewverb, and converting a string to aGuidhappens where necessary automatically, at least I think it does.powercode commentedon Nov 21, 2016
I agree about -Guid.
But as Guids are values without identity, you create then with new-guid. Why not provide a way to create the sentinel guid?
It is a lot more discoverable than [guid]::Empty, and easier to type on many keyboard layouts where
'[' and ']' are AltGr+8 and AltGr+9.
iSazonov commentedon Nov 22, 2016
Some applications use GUID as a unique identifier. In this case, the identifier is a string. So really, we can get a stream of strings (ex. from logs), that we want to convert to
[guid]. And yes this is more forConvertTo-Guidbut I looked throughNew-*cmdlets and many of them do a similar operation (string -> object). Most likely the newConvertTo-Guidcmdlet is redundant and perhaps it would be better to make theGUIDparameter.Actually I'm surprised that
New-Guidhas appeared. But if it is, then it is logical to realize a full set of features includingEmpty. It is also used by some applications (ex. SCCM).If we do not do
GuidandEmptyand do not usepipelinethere is an option to make a breaking change and removeNew-Guidbecause there is[guid].iSazonov commentedon Dec 2, 2016
PowerShellTeam Please close the Issue.