SnapCenter 6.0 Cmdlet Reference Guide For Windows ( CA08871-610en )

SnapCenter PowerShell requirements

You must install PowerShell 7 when you upgrade SnapCenter. You must use one of the workarounds provided in this section to use the automatic import module feature.

Using UI

Ensure that you use the desktop shortcut provided on the SnapCenter Server to start and import the module.

This shortcut sets up a PowerShell session with the necessary modules that were imported earlier.

Using script

Option 1: Update the script to include the Import-Module command.

Each script explicitly imports the SnapCenter module before attempting to use its commands. This ensures that the module is loaded regardless of the environment it has run in.

Step
  1. Run the following command at the beginning of the PowerShell script:

    Import-Module SnapCenter -DisableNameChecking

Option 2: Update the Windows task scheduler command.

You can modify the task in the Task Scheduler to first load the module and then execute the script. This can be done by chaining commands in the 'Actions' settings when you edit the task.

Step
  1. Run the following command for the task:

    "C:\Program Files\PowerShell\7\pwsh.exe" -noe -c "& { . 'C:\Program Files\PowerShell\7\Modules\SnapCenter\Scripts\Initialize-SnapCenterPS-Environment.ps1' 'NetApp'; & '<customer script file path>' }"

    For example, "C:\Program Files\PowerShell\7\pwsh.exe" -noe -c "& { . 'C:\Program Files\PowerShell\7\Modules\SnapCenter\Scripts\Initialize-SnapCenterPS-Environment.ps1' 'NetApp'; & 'C:\test.ps1' }"

Option 3: Update the PowerShell profile file.

To ensure that the SnapCenter module is imported every time a PowerShell session starts, you must edit the PowerShell profile script. This is useful if you have multiple scripts that depend on the SnapCenter module.

Steps
  1. Run the following command to create the profile file:

    notepad $PROFILE

    This will open the profile file or creates it if it does not exist.

  2. Run the following command to check if the SnapCenter module exists before trying to import.

    Ensure that you update the path accordingly.

    $modulePath = 'C:\Program Files\PowerShell\7\Modules\SnapCenter\SnapCenter.psd1' if (Test-Path $modulePath) { Import-Module $modulePath -DisableNameChecking } else { Write-Warning "SnapCenter module not found at path: $modulePath" }

Top of Page