Subscribe

Backing up Name Mappings and Password file

I am looking for a way to backup the password file for Unix Users as well as the Name Mappings. In 7 mode, this was an easy task to do as it was just copying the file from etc$. But, as with most things, in CDOT this is much more dificult. I know the data can be obtained from the CLI, but you must be in DIAG most. We have ~100 clusters to backup. I already have scripts running that grab all NFS, CIFS, etc. data but nothing for the names or mappings. I would prefer something in powershell if available, but if not, I can pipe PLINK data to a text file. 

Re: Backing up Name Mappings and Password file

Livewire, 

 

I believe you should be able to use the Get-NcNameMappingUnixUser commandlet to get at what you are after from a powershell perspective. 

Re: Backing up Name Mappings and Password file

Sorry it took me a while to get back. I have been working on a few projects. I have looked at NcNameMappingUnixUser but it is not really giving me the data in a usable format. 

 

When running from PS> prompt, it give me the info in a nice table. When doing so in a script though, it comes out unusable (shown below). I have been trying to find a way to cycle through the object and grabe the needed fields like I have done with other cmdlets, but no use so far. Do you have any suggestions in how to get the named fields below to be variables?

 

 

 

FullName :
GroupId : 1
NcController : cluster.domain.name
UserId : 0
UserName : root
Vserver : vserver01
GroupIdSpecified : True
UserIdSpecified : True

Re: Backing up Name Mappings and Password file

So your output below just looks like the default list output for the object type being generated. When you say working with them in a script what do you mean? If you put all your output into an array you can then export that arry to a CSV to get you a pretty easy to manipulate output. For Example: 

 

$nameMapList = @(Get-NcNameMappingUnixUser) 

 

$nameMapList | Export-Csv -NoTypeInformation -Path C:\namemaps.csv 

 

You could also start building your own objects with just the values you want and exporting them another way there are multiple ways to do it if you want to give me an example of what you are doing in your script I can help. 

Re: Backing up Name Mappings and Password file

@NICKBARTON

 

 

Thanks, for the info. 

 

What I am going to be doing is creating a backup file for each SVM across our clusters. I have the script already to connecto to each cluster and then I will be wanting to backup all the fields (name, gid, uid, etc) for each Unix User. I will want to do the same for each Unix group and NameMapping (i.e Win-Unix, Unix-Win). This will be done for backup purposes in the event of a DR or corruption, and also will be used for an upcoming move to LDAP. 

 

I can gather nearly all of this data in PS> CLI, but doing so in PS Script is my issue. So, if I can learn how to assign object items to named variables that would be super helpful.