|
|
Set-Item and the magic -concatenate argument...
Received a powertip email today stating:
Use the -Concatenate switch to add new entries without overwriting existing
entries:
Set-Item WSMan:\localhost\client\trustedhosts
10.10.10.10 -force -concatenate
So I ask help for the Set-Item cmdlet, but cannot find the -concatenate
switch.
On the other hand, typing the statement below, followed by tab-completion, I
surely see the -concatenate switch:
Set-Item WSMan:\localhost\client\trustedhosts 10.10.10.10 -force -con<TAB>
However, the command below does not recognize the -concatenate switch:
set-item -path alias:np -value c:\windows\notepad.exe -con<TAB>
So there must be something "intelligent" at run-time, probably depending on
the provider. What is the magic term here? Where/how does tab-completion
look for relevant arguments?
Thanx,
~Hans
|
|
0
|
|
|
|
Reply
|
Hans
|
11/23/2009 8:58:44 PM |
|
Hi Hans,
Concatenate is a dynamic parameter (provider specific paremeter) it is available
only when you use the cmdlet with the provider data.
That said, I think it has a bug. If you type:
set-item WSMan:\localhost\Client\TrustedHosts -c[TAB]
and press the tAb key few times then the parameters that gets completed are
only: confirm and credential.
However, if you type:
set-item WSMan:\localhost\Client\TrustedHosts -co[TAB]
the concatenate is added.
You can read more on the dynamic parameters on the powershell team blog:
http://blogs.msdn.com/powershell/archive/2009/05/28/adding-custom-cmdlet-help-for-providers.aspx
Or by reading the about_providers help file.
---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar: http://tinyurl.com/PSToolbar
HD> Received a powertip email today stating:
HD>
HD> Use the -Concatenate switch to add new entries without overwriting
HD> existing
HD> entries:
HD> Set-Item WSMan:\localhost\client\trustedhosts
HD> 10.10.10.10 -force -concatenate
HD> So I ask help for the Set-Item cmdlet, but cannot find the
HD> -concatenate switch.
HD>
HD> On the other hand, typing the statement below, followed by
HD> tab-completion, I surely see the -concatenate switch:
HD>
HD> Set-Item WSMan:\localhost\client\trustedhosts 10.10.10.10 -force
HD> -con<TAB>
HD>
HD> However, the command below does not recognize the -concatenate
HD> switch:
HD>
HD> set-item -path alias:np -value c:\windows\notepad.exe -con<TAB>
HD>
HD> So there must be something "intelligent" at run-time, probably
HD> depending on the provider. What is the magic term here? Where/how
HD> does tab-completion look for relevant arguments?
HD>
HD> Thanx,
HD> ~Hans
|
|
0
|
|
|
|
Reply
|
Shay
|
11/23/2009 10:37:24 PM
|
|
|
1 Replies
373 Views
(page loaded in 0.035 seconds)
Similiar Articles: Set-Item and the magic -concatenate argument... - microsoft.public ...Received a powertip email today stating: Use the -Concatenate switch to add new entries without overwriting existing entries: Set-Item WSMan:\lo... Setting Scope of name ranges to particular worksheet - microsoft ...Set-Item and the magic -concatenate argument... - microsoft.public ..... to add new entries without overwriting existing entries: Set ... to the Tclers Wiki!... them ... MSScriptControl.ScriptControl help - microsoft.public.windows ...Set-Item and the magic -concatenate argument... - microsoft.public ... MSScriptControl.ScriptControl help - microsoft.public.windows ... 'Set groupList = Nothing End ... microsoft.public.access.formsItems(6882) /689 Next >> Last >| ... font for forms in Access 2007 Utf 1 823 How do you set a ... applying concatenate filter Utf 1 294 Hi All, I tried to filter ... How to output file to remote server via Out-File -filepath ...... Out-File : Cannot validate argument "+" because it does not belong to the > set ... In expression mode strings concatenation works ... File size limit when using Move-item ... Opening up in RichTextBox2 ? - microsoft.public.dotnet.languages ...... not with the code in the second set ... Item the first: In your code, you do have the potential for an error, but the concatenation operator ("&" symbol) is saving ... Parsing CSV files - microsoft.public.vc.mfc... SetValue(Me, CInt(flds.Item(i ... not end in double quote, so you continue with a concatenation ... otherwise, you terminate the parse and set up so ... Set-Item and the magic -concatenate argument... - microsoft.public ...Received a powertip email today stating: Use the -Concatenate switch to add new entries without overwriting existing entries: Set-Item WSMan:\lo... How to Use Excel's Concatenate Function | eHow.comLook at an example for Concatenate. Set ... category and then the "Concatenate" function. Supply the arguments ... Excel, merging text items is the job of the "Concatenate ... WSH Command Line Arguments - CIS Department > Home... vbCRLF End Sub set args = WScript.Arguments num = args ... too, that the & is the string concatenation ... for k = 0 to num - 1 Set oFile = oFSO.GetFile(args.Item(k ... Introduction to Python: Functions - Penzilla.net... item in list: nlist.append( fun( item ) ) return nlist # But here we have to use concatenation, or the + operator for ... an easy way to set just the arguments ... Functions in InfoPath - InfoPath - Office.comIf the argument is a set of fields or groups, it returns the name of the first field or ... concat : Combines the value of fields with other fields or text strings. concat ... 7/18/2012 2:46:55 PM
|
|
|
|
|
|
|
|
|