Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
1 ACCEPTED SOLUTION
koushi has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
3 REPLIES 3
koushi has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
^^
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
