PowerShell script exchange
Post Reply
AlexL
Service Provider
Posts: 105
Liked: 7 times
Joined: Aug 24, 2010 8:55 am
Full Name: Alex
Contact:

set repository credentials

Post by AlexL »

Maybe I've overlooked something but how would I set credentials for existing repositories?
Regards,
Alex
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: set repository credentials

Post by ThomasMc »

off the top of my head you would use Get-VBRServer to pull the one hosting the repo and there is a method in there to set it(.setcred() or something to that effect (Use "Get-VBRServer - Name "RepoServer" | gm" to get a list), I'm just powering up the lab and will provide a more detailed post soon :)
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: set repository credentials

Post by ThomasMc »

Forget to ask, what type of repo is it? (Win/Linux/CIFS)
AlexL
Service Provider
Posts: 105
Liked: 7 times
Joined: Aug 24, 2010 8:55 am
Full Name: Alex
Contact:

Re: set repository credentials

Post by AlexL »

cifs
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: set repository credentials

Post by ThomasMc »

If it was any other one I would have had the answer a while ago lol

Code: Select all

$repo = Get-VBRBackupRepository -Name CIFS
$creds = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList "testdomain\User","Password",0,1
$credentials = New-Object -Type Veeam.Backup.Model.CDbCredentialsInfo -ArgumentList $repo.ShareCredsId, $creds
$manager = [Veeam.Backup.DBManager.CDBManager]::Instance
$manager.Credentials.UpdateCredentials($credentials)
AlexL
Service Provider
Posts: 105
Liked: 7 times
Joined: Aug 24, 2010 8:55 am
Full Name: Alex
Contact:

Re: set repository credentials

Post by AlexL »

Hi Thomas,

Your code works BUT only for changing existing credentials, in my case I do not have credentials in place yet. So the checkbox also needs to be set.

Thank you very much for your quick replies and efforts so far.

Regards,
Alex
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: set repository credentials

Post by ThomasMc »

Hi Alex, I can't seem to find how to do it, what's funny is I can't get credentials enabled at all when using Powershell with CIFS, the other types get there creds from the stored hosts(why I suggested Get-VBRServer in my first post) but CIFS seems to have me scratching my head as to how your suppose to enable it, as the Add-VBRBackupRepository seems more geared towards the Win/Linux ones and doesn't take a input for what we're trying to do. I'd advise you to open a support case as I might have missed something.
Andreas Neufert
VP, Product Management
Posts: 7081
Liked: 1511 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: set repository credentials

Post by Andreas Neufert »

just a small idea. edit one of your repositories mannual with all neccesarry settings. then copy it with powershell and do the neccesarry changes. copy instead of creating a new one. maybe this is a workaround.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 9 guests