Skip to content

Commit 437fefe

Browse files
committed
Initial commit
1 parent c7c73cb commit 437fefe

6 files changed

Lines changed: 537 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.psd1
2+
release/

OnCommand-Insight-Tutorial.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# OnCommand Insight (OCI) PowerShell Cmdlet Tutorial
2+
3+
This tutorial will give an introduction to the OnCommand Insight PowerShell Cmdlets
4+
5+
## Discovering the available Cmdlets
6+
7+
Load the OCI Module
8+
9+
```powershell
10+
Import-Module OnCommand-Insight
11+
```
12+
13+
Show all available Cmdlets from the OCI Module
14+
15+
```powershell
16+
Get-Command -Module OnCommand-Insight
17+
```
18+
19+
Show the syntax of all Cmdlets from the OCI Module
20+
21+
```powershell
22+
Get-Command -Module OnCommand-Insight
23+
```
24+
25+
To get detailed help including examples for a specific Cmdlet (e.g. for Connect-OciServer) run
26+
27+
```powershell
28+
Get-Help Connect-OciServer -Detailed
29+
```
30+
31+
## Connecting to an OCI Server
32+
33+
For data retrieval a connection to the OCI Server is required. The Connect-OciServer Cmdlet expects the hostname or IP and the credentials for authentication
34+
35+
```powershell
36+
$ServerName = 'ociserver.example.com'
37+
$Credential = Get-Credential
38+
Connect-OciServer -Name $ServerName -Credential $Credential
39+
```
40+
41+
If the login fails, it is often due to an untrusted certificate of the OCI Server. You can ignore the certificate check with the `-insecure` option
42+
43+
```powershell
44+
Connect-OciServer -Name $ServerName -Credential $Credential -Insecure
45+
```
46+
47+
By default the connection to the OCI server is established through HTTPS. If that doesn't work, HTTP will be tried.
48+
49+
To force connections via HTTPS use the `-HTTPS` switch
50+
51+
```powershell
52+
Connect-OciServer -Name $ServerName -Credential $Credential -HTTPS
53+
```
54+
55+
To force connections via HTTP use the `-HTTP` switch
56+
57+
```powershell
58+
Connect-OciServer -Name $ServerName -Credential $Credential -HTTP
59+
```
60+
61+
As the Timezone of the OCI Server is not available via the REST API, it needs to be manually set. By default the Timezone will be set to the local timezone of the PowerShell environment.
62+
63+
The currently configured timezone of the OCI Server can be checked with
64+
65+
```powershell
66+
$CurrentOciServer.Timezone
67+
```
68+
69+
A list of all available timezones can be shown with
70+
71+
```powershell
72+
[System.TimeZoneInfo]::GetSystemTimeZones()
73+
```
74+
75+
To set a different timezone (e.g. CEST or PST), the following command can be used
76+
77+
```powershell
78+
$CurrentOciServer.Timezone = [System.TimeZoneInfo]::FindSystemTimeZoneById("Central Europe Standard Time")
79+
$CurrentOciServer.Timezone = [System.TimeZoneInfo]::FindSystemTimeZoneById("Pacific Standard Time")
80+
```

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
OnCommand-Insight
2+
=================
3+
4+
OnCommand-Insight PowerShell Module
5+
6+
Installation
7+
------------
8+
9+
Extract OnCommand-Insight.zip either to your preferred PowerShell Module location (e.g. `$HOME\WindowsPowershell\Documents\WindowsPowerShell\Modules` or `C:\Windows\System32\WindowsPowerShell\v1.0\Modules`).
10+
11+
Usage
12+
-----
13+
14+
Check if OnCommand-Insight Module can be found by PowerShell
15+
16+
Get-Module -ListAvailable OnCommand-Insight
17+
18+
Import PowerShell Module
19+
20+
Import-Module OnCommand-Insight
21+
22+
List all Cmdlets included in the OnCommand-Insight Module
23+
24+
Get-Command -Module OnCommand-Insight
25+
26+
Show help for Cmdlet to connect to OnCommand-Insight Server
27+
28+
Get-Help Connect-OciServer -Detailed
29+
30+
Connect to OnCommand Insight Server using the `-Insecure` Switch to skip checking the certificate of the server
31+
32+
$Credential = Get-Credential
33+
Connect-OciServer -Name myserver.mydomain.tld -Credential $Credential -Insecure
34+
35+
List all Storage Arrays
36+
37+
Get-OciStorageArrays
38+
39+
Trusting the Publisher of the OnCommand Insight Cmdlets
40+
-------------------------------------------------------
41+
42+
This PowerShell Module is signed with a code signing certificate issued by the *NetApp Corp Issuing CA 1*. If the PowerShell execution policy requires powershell scripts to be signed (see [about_Execution_Policies](technet.microsoft.com/library/hh847748.aspx) for details), two steps are required to run this PowerShell Module
43+
44+
1. Trust the NetApp Root Certification Authority. This can be done with the following command executed in PowerShell `Start-Process powershell -Verb RunAs -ArgumentList '-nologo -command (New-Object System.Net.WebClient).DownloadFile(\"http://pki2.netapp.com/pki/NetApp%20Corp%20Root%20CA.crt\",\"$env:TEMP\netapp.crt\");certutil -addstore root $env:TEMP\netapp.crt;rm $env:TEMP\netapp.cr*;PAUSE'` or manually via the following steps:
45+
1. downloading the NetApp Root CA certificate from (http://pki1.netapp.com/pki/NetApp%20Corp%20Root%20CA.crt)
46+
2. double click on the downloaded file
47+
3. click on *Install Certificate...*
48+
4. click on *Next >*
49+
5. Select *Place all certificates in the following store*
50+
6. Click *Browse*
51+
7. Select *Trusted Root Certification Authorities*
52+
8. Click *OK*
53+
9. Click *Next >*
54+
10. Click Finish
55+
11. A *Security Warning* will be displayed. Click *Yes* to install the certificate. The *Thumbprint (sha1)* should be **9FFB6F1A 06BC0245 27368705 2E7309D3 6FF2CFD0**
56+
12. Click twice on *OK* to close the dialogs.
57+
2. When importing the PowerShell module via `Import-Module OnCommand-Insigh` a dialog is displayed asking if the publisher *CN=florianf-Florian-Feldhaus, OU=Users, OU=EMEA, OU=Sites, DC=hq, DC=netapp, DC=com* should be trusted. Select *[A] Always run* to permanently trust this publisher.
58+
59+
60+
Changelog
61+
---------
62+
63+
### Version 0.3
64+
65+
* Module is now signed
66+
* added instructions to trust the publisher of the Module
67+
* added ability for most cmdlets to accept pipeline input
68+
* streamlined usage of the parameter ID. All cmdlets accepting ID parameters now have named parameters like VolumeID or HostID and ID is an alias to these parameters (e.g. ID always works).
69+
* added formatting of OCI types
70+
71+
### Version 0.2
72+
73+
* improved Help and added Parameter Help
74+
* solved Namespace issues when changing server and introduced OCI namespace
75+
* improved build process
76+
77+
### Version 0.1
78+
79+
* First internal release with all Cmdlets implemented

src/S3-Mgmt-examples.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Import-Module ./S3-Mgmt.ps1
2+
3+
# Retrieve administrator credentials for StorageGRID NMS
4+
$Credential = Get-Credential
5+
6+
# Connect to StorageGRID NMS
7+
Connect-S3Mgmt -Name cbc-sg-adm1.muccbc.hq.netapp.com -Credential $credential -Insecure
8+
9+
# retrieve all S3 Accounts
10+
Get-S3Accounts
11+
12+
# retrieve usage of each S3 Account
13+
Get-S3Accounts | Get-S3AccountUsage
14+
15+
# create CSV Output S3 Account usage
16+
17+
$Accounting = foreach ($Account in Get-S3Accounts) {
18+
$Usage = Get-S3AccountUsage -id $Account.id
19+
$Output = New-Object -TypeName PSCustomObject -Property @{Name=$Account.name;ID=$Account.id;"Calculation Time"=$Usage.calculationTime;"Object Count"=$Usage.objectCount;"Data Bytes used"=$Usage.dataBytes}
20+
Write-Output $Output
21+
}
22+
23+
Export-Csv -Path C:\tmp\usage.csv -NoTypeInformation -InputObject $Accounting

0 commit comments

Comments
 (0)