Microsoft Virtualization Discussions

Ontap PowerShell, Unix-User and cDot

tomers
4,832 Views

Hi guys, 

 

on cDot CLI we have this command to add and remove users

vserver services unix-user create -vserver SVM -user USER........

 

I need to create a script that do that, do we have a cmdlet for it in the toolkit ?

 

 

*on 7-mode we called those passwd file.

 

 

Thanks, 

 

Tomer.

5 REPLIES 5

HONIG2012
4,829 Views

well i think "New-NcUser" should solve your problem for cDOT systems

grEEtz

 

-----

> man new-ncuser

NAME
    New-NcUser

SYNOPSIS
    Create a new user account associated with the specified application and authentication method.


SYNTAX
    New-NcUser [-UserName] <String> -Vserver <String[]> -Application <String[]> [-AuthMethod <String>] -Role <String> [-Password <String>] [-Comment
    <String>] [-Controller <NcController[]>] [-ZapiRetryCount <Int32>] [<CommonParameters>]

    New-NcUser -Vserver <String[]> -Application <String[]> [-AuthMethod <String>] -Role <String> [-Credential <PSCredential>] [-Comment <String>]
    [-Controller <NcController[]>] [-ZapiRetryCount <Int32>] [<CommonParameters>]


DESCRIPTION
    Create a new user account associated with the specified application and authentication method.

 

 

tomers
4,819 Views

Hi, 

Thanks for replaying.

New-NcUser is for creating users for login (ssh\ontapi....)

 

but i just found what i needed. its NcNameMappingUnixUser

Get-NcNameMappingUnixUser

Set-NcNameMappingUnixUser

New-NcNameMappingUnixUser

Remove-NcNameMappingUnixUser

 


Thank you.

Tomer.

Livewire18
3,594 Views

 

I am trying to backup my name mappings... 

 

When running from PS> prompt, it gives 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

tomers
3,557 Views

It depand on what do you want to do with it and how.

For example if you want to see the username+UID+vservername on screen then use this: 

$NcNameMappingUnixUser = NcNameMappingUnixUser; foreach($line in $NcNameMappingUnixUser) {write-host "$($line.UserName) $($line.UserId) $($line.Vserver)"}

if you want to check for specific user name in a specific vserver use this: 

$NcNameMappingUnixUser = NcNameMappingUnixUser; foreach($line in $NcNameMappingUnixUser) {if ($line.UserName -eq 'pcuser' -and $line.Vserver -eq 'svm1') {write-host $($line.UserName)  $($line.UserId) $($line.Vserver)"}}

or:

$NcNameMappingUnixUser = NcNameMappingUnixUser; $NcNameMappingUnixUser | ForEach-Object {if ($_.UserId -eq 65535) {$_ | Format-Table UserName,  UserId, Vserver} }

 

or just format-table: 

$NcNameMappingUnixUser | Format-Table UserName,  UserId, Vserver

 

so it depends on what you want to gain, but those are more Powershell tips them DataOntap ToolKit.

 

Livewire18
3,543 Views

This is perfect! Thank you very much.

Public