Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
How to add $ at the end of the user provided information.
My Qtree should be add with _q at the end once user provided qtree as test then it should be tree_q
My sharename should be add with $ at the end once user provided qtree as test then it should be tree$
For more information
$qtreename = Read-Host -Prompt 'Input your QTREE name'
New-NcQtree -Volume $volumename -Qtree $qtreename -SecurityStyle ntfs -Vserver $vservername # here Qtree name need to be append as '_q' at the end of qtree name
Add-NcCifsShare -Name $share -Path $pathname1 -SymlinkProperties hide -OfflineFilesMode Manual -VscanProfile strict -Vserver $vservername # Here sharename should follows with Qtreename$ as powershell takes $ as input of the variable im facing few challenges
can anyone please help
Solved! See The Solution
Escaping the $ with "`" should do the trick ...
$qtreename = Read-Host -Prompt 'Input your QTREE name' $qtreename = $qtreename + "_q" #Append _q to the qtree name that was input New-NcQtree -Volume $volumename -Qtree $qtreename -SecurityStyle ntfs -Vserver $vservername $share = "`$$qtreename" #` is the escape character in PowerShell Add-NcCifsShare -Name $share -Path $pathname1 -SymlinkProperties hide -OfflineFilesMode Manual -VscanProfile strict -Vserver $vservername
Hope this helps,
Aparajita
Escaping the $ with "`" should do the trick ...
$qtreename = Read-Host -Prompt 'Input your QTREE name' $qtreename = $qtreename + "_q" #Append _q to the qtree name that was input New-NcQtree -Volume $volumename -Qtree $qtreename -SecurityStyle ntfs -Vserver $vservername $share = "`$$qtreename" #` is the escape character in PowerShell Add-NcCifsShare -Name $share -Path $pathname1 -SymlinkProperties hide -OfflineFilesMode Manual -VscanProfile strict -Vserver $vservername
Hope this helps,
Aparajita
^^
Unless i'm reading this wrong, I don't think that's what he's asking for..
You want to know how to add $ to the end of a share before you create it so it's hidden, right?
Hey JGPSHNTAP,
The one which im looking for is been answered by Aparajita.
As powershell never allow $ at the end we can user '$ at the end will works..
I tried the same and it worked.
Thanks to both of you.