cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3256
Views
5
Helpful
8
Comments
sumbr
Level 4
Level 4

This script is used to collect global policies. For ex - The global cap policy is a global policy that specifies whether policy-driven chassis group power capping or manual blade-level power capping will be applied to all servers in a chassis.

Comments
menzies456
Level 1
Level 1

Hello,

I am about to give up on power shell!

I have tried to use this script.

I Connect to my UCS and run this script without editing at all.

It comes back with an invoke with one argument error.

Is this because I have not edited the script first?

Many Thanks for any help

Sam

nveda
Level 1
Level 1

Hi Sam,

Connect to any UCS and then try following. Get-UcsGlobalPolicy.ps1script looking for UCS on which you want to retrieve global policies.

PS C:\Users\nveda\Desktop\Scripts> connect-ucs 10.65.*.*

cmdlet Connect-Ucs at command pipeline position 1

Supply values for the following parameters:

Credential

Proxy :

Cookie : 1443613869/7e67a955-b8ea-480b-9256-fa124fed920a

Domains :

LastUpdateTime : 9/30/2015 5:21:09 PM

Name : 10.65.183.5

NoSsl : False

NumPendingConfigs : 0

NumWatchers : 0

Port : 443

Priv : {admin, read-only}

RefreshPeriod : 600

SessionId : web_22873_A

TransactionInProgress : False

PromptOnCompleteTransaction : False

Ucs : tcs-tpi01

Uri : https://10.65.*.*

UserName : admin

VirtualIpv4Address : 10.65.*.*

Version : 2.2(5a)

WatchThreadStatus : None

PS C:\cygwin\home\nveda\trunk\PS\Cmdlets\Samples> .\Get-UcsGlobalPolicy.ps1 tcs-tpi01 | more

AdminState : enabled

ConfigState : success

Date : 1970-01-01T05:30:00.000

Descr :

Name :

OperPort : 0

OperTimezone : Asia/Kolkata

PolicyLevel : 0

PolicyOwner : local

Port : 0

Proto : none

Timezone : Asia/Kolkata

Dn : sys/svc-ext/datetime-svc

Rn : datetime-svc

Status :

XtraProperty : {}

Ucs : tcs-tpi01

AdminState : enabled

Descr :

Hostname :

Name : 64.104.193.12

Dn : sys/svc-ext/datetime-svc/ntp-64.104.193.12

Rn : ntp-64.104.193.12

Status :

XtraProperty : {}

Ucs : tcs-tpi01

Let us know if you have more questions.

Thank you,

Nitin

menzies456
Level 1
Level 1

Hi,

I still have an issue.

If I connect to my ucs with connect-ucs 10.x.x.x

Then what is this section for and do I not just run .\Get-UcsGlobalPolicy.ps1 from the command line?

I am sure I must be missing something?

Thanks

Sam

cmdlet Connect-Ucs at command pipeline position 1

Supply values for the following parameters:

Credential

Proxy                       :

Cookie                      : 1443613869/7e67a955-b8ea-480b-9256-fa124fed920a

Domains                     :

LastUpdateTime              : 9/30/2015 5:21:09 PM

Name                        : 10.65.183.5

NoSsl                       : False

NumPendingConfigs           : 0

NumWatchers                 : 0

Port                        : 443

Priv                        : {admin, read-only}

RefreshPeriod               : 600

SessionId                   : web_22873_A

TransactionInProgress       : False

PromptOnCompleteTransaction : False

Ucs                         : tcs-tpi01

Uri                         : https://10.65.*.*

UserName                    : admin

VirtualIpv4Address          : 10.65.*.*

Version                     : 2.2(5a)

WatchThreadStatus           : None

sumbr
Level 4
Level 4

Hi Sam,

What is the error you are getting?

Here is what you can try to get the Global policies using this script.

Establish a connection to your UCS using this statement

$ucsConnection = Connect-Ucs 10.x.x.x

then run the script as mentioned below.


Get-UcsGlobalPolicy.ps1 $ucsConnection.Ucs


Hope this helps. Let us know if you have further questions.

Thanks,

Sumanth

menzies456
Level 1
Level 1

I get this error when running the above?

Thanks

Sam

PowerTool C:\Users\sam.wharton.EU\Desktop> Get-UcsGlobalPolicy.ps1 $ucsConnection.Ucs

The term 'Get-UcsGlobalPolicy.ps1' is not recognized as the name of a cmdlet, function, script file

, or operable program. Check the spelling of the name, or if a path was included, verify that the p

ath is correct and try again.

At line:1 char:24

+ Get-UcsGlobalPolicy.ps1 <<<<  $ucsConnection.Ucs

    + CategoryInfo          : ObjectNotFound: (Get-UcsGlobalPolicy.ps1:String) [], CommandNotFound

   Exception

    + FullyQualifiedErrorId : CommandNotFoundException

Suggestion [3,General]: The command Get-UcsGlobalPolicy.ps1 was not found, but does exist in the cur

rent location. Windows PowerShell doesn't load commands from the current location by default. If you

trust this command, instead type ".\Get-UcsGlobalPolicy.ps1". See "get-help about_Command_Precedenc

e" for more details.

PowerTool C:\Users\sam.wharton.EU\Desktop>

nveda
Level 1
Level 1

Hi Sam,

Can you try following, if you want to run it from desktop.

.\Get-UcsGlobalPolicy.ps1 $ucsConnection.Ucs

PowerTool C:\Users\sam.wharton.EU\Desktop>.\Get-UcsGlobalPolicy.ps1 $ucsConnection.Ucs

Thank you,

Nitin

menzies456
Level 1
Level 1

PowerTool C:\Users\sam.wharton.EU\Desktop> ./Get-UcsGlobalPolicy.ps1

C:\Users\sam.wharton.EU\Desktop\Get-UcsGlobalPolicy.ps1 : Invoke with one argument.

At line:1 char:26

+ ./Get-UcsGlobalPolicy.ps1 <<<<

    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException

    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-UcsGlobalPolic

   y.ps1

I still just get this error?

Sam

sumbr
Level 4
Level 4

Hi Sam,

This seems to be a path issue. Where is the script located on your system? Can you please traverse to the directory where the script is present and from there you can run the script with the syntax mentioned below.

$ucsConnection = Connect-Ucs <UCSNAME>

.\Get-UcsGlobalPolicy.ps1 $ucsConnection.Name.

Thanks,

Sumanth

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links

Review Cisco Networking for a $25 gift card