« Back to Microsoft Discussions

PowerTool Backup-Ucs cmdlet issue

Combination View Flat View Tree View
Threads [ Previous | Next ]
When running Backup-Ucs cmdlet, I'm forced to use single quote if I'm trying to use the built-in ${ucs}, ${yyyy}, ${MM}, ${dd}, etc. But this forces me to hard code the path in the -PathPattern. If I try to use a variable to store the path, like '$myBackupPath\${ucs}-${yyyy}${MM}${dd}-config-all.xml', this will not work.
But when I change it to double-quote, the cmdlet doesn't resolve ${ucs}, ${yyyy}, etc.
The other issue (it might be by design but I'd like to have a confirmation from dev team):
the output of Backup-Ucs has a weird Hostname - it has the machine name + yyyyMMddHHmm format.
I'm using PowerTool 0.9.6.0.

Jason,

The Backup-Ucs cmdlet is designed to substitute some variables like ${ucs} and DateTime format specifiers in the PathPattern with the corresponding values. If you use a double-quote, the variables will be interpreted by PowerShell. If you want to use a variable, you can do the following:


PS C:\> del C:\work\Backups\*.xml
PS C:\> $myBackupPath="C:\work\Backups"
PS C:\> Backup-Ucs -Type config-all -PathPattern ($myBackupPath + '\${ucs}-${yyyy}${MM}${dd}-config-all.xml')


AdminState : disabled
Descr :
Hostname : bjayakri-wxp201203281849
Job : immediate
Name :
PostAction : remove
PreservePooledValues : no
Proto : http
Pwd :
RemoteFile : C:\work\Backups\bgl-samc03-20120328-config-all.xml
Type : config-all
User :
Dn : sys/backup-bjayakri-wxp201203281849
Rn : backup-bjayakri-wxp201203281849
Status :
Ucs : bgl-samc03



PS C:\> dir C:\work\Backups


Directory: C:\work\Backups


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 3/28/2012 6:49 PM 25665 bgl-samc03-20120328-config-all.xml


PS C:\>


PowerTool 0.9.7.0 was released yesterday and has a lot of interesting & useful additions. Give it a try.


Thanks,
- bhaskar

Thanks for the help Bhaskar. I'll try the new release.

Jason