Solved

Is there a Powershell tutorial?


Badge
I am an experienced developer but I am new to PowerShell. I am working on some automation for our line of business app that will need to leverage some Nutanix functionality and I am having a hard time getting things started. From what I have gathered so far, I will need to do the following but it is unclear exactly how.

I have tried the following line at the top of my script and this worked or seemed to work at least once before: Invoke-Expression "& 'C:\Nutanix Inc\NutanixCmdlets\powershell\import_modules\PreReqCheckAndImport.PS1'"

  • If I want to deploy scripts to my data center can I simply copy all of the Cmdlets to whatever server I want to run the script or do I need to use the installer?
icon

Best answer by sandeepmp 16 September 2018, 18:04

@Jeremy Rammalaere

You need to add below line in the beginning of the script, which will load the module.

#Add NutanixCMDletsPSSnapin
Add-PSSnapin NutanixCMDletsPSSnapin

View original

6 replies

Userlevel 4
Badge +19
@Jeremy Rammalaere

You need to add below line in the beginning of the script, which will load the module.

#Add NutanixCMDletsPSSnapin
Add-PSSnapin NutanixCMDletsPSSnapin
Badge
Thank you. What about deploying my scripts? Will I need to run the Cmdlet installer or can I just copy all of the files with my script?
Userlevel 4
Badge +19
@Jeremy Rammalaere

You would need to install the commandlets in the machine which you run the script and load the snapin
Badge
Thank you. I seem to have one other issue. There is no secure way to save credentials or use a trusted AD login for the script. I have enabled AD authentication, is there a way to use a "trusted connection" similar to the way MS SQL Server works? I truly do not want to save any credentials in my script or on disk.
Badge +3
Not found a secure way to save creds for NX cluster authentication.

The only option I could think of is to perhaps use ADFS authentication with Prism Central -> then to the cluster...

https://portal.nutanix.com/#/page/docs/details?targetId=Prism-Central-Guide-Prism-v510:mul-security-authentication-pc-t.html
Badge
@DavidN, thank you for the reply. I already had AD integration enabled and something still didn't go right. I have switched my approach to the problem and I am using the REST API now.

Reply