Hi all,
I'm running the vCheck for Cisco UCS, but it keep prompting for UCS manager credential. I have stored the password using New-VICredentialStoreItem -Host 192.168.1.10 -User Admin -Password pass, but still its prompting me for password. I'm able to receive the report successfully over mail. but every time, i need to enter credential which i want to avoid.
Any help will be appreciated.
Thanks
V
You need to do it in the file your pointing to. Below is what's working for me, the only difference is I'm converting the password in plaintext, to do it more securely you should be able to replace the bold part with LucD suggestions
$Title = "Connection settings for UCS"
$Author = "Joshua Barton, Alan Renouf"
$PluginVersion = 1.1
$Header = "Connection Settings"
$Comments = "Connection Plugin for connecting to Cisco UCS"
$Display = "List"
$PluginCategory = "UCS"
# Start of Settings
# Please Specify the hostname or IP address of the UCS Domain to connect to:
$UcsDomain = ""
# End of Settings
# Setup plugin-specific language table
$pLang = DATA {
ConvertFrom-StringData @'
loadModFail = Unable to load UCS Powertool Module. Please verify that it has been installed.
loadModSuccess = Successfully loaded Cisco UCS PowerTool
connOpen = Connecting to UCS Domain
connError = Unable to connect to UCS Domain, please verify address and credentials
collectDomain = Collecting UCS Domain Status
collectSp = Collecting Service Profile Objects
collectSpTemplate = Collecting Service Profile Template Objects
collectBlades = Collecting Blade Objects
collectRackUnits = Collecting RackUnit Objects
collectFi = Collecting Fabric Interconnect Objects
collectPortLic = Collecting Port License Objects
collectFiEth = Collecting FI Ethernet Port Objects
collectFiSan = Collecting FI SAN Port Objects
collectChassis = Collecting Chassis Objects
collectFaults = Collecting Fault Objects
collectFirmware = Collecting Infrastructure Firmware Object
collectKvm = Collecting KVM Management IP Objects
collectUuid = Collecting UUID Objects
collectMac = Collecting MAC Objects
collectWwnBlock = Collecting WWN Block Objects
collectWwnnPool = Collecting WWNN Pool Objects
collectWwpnPool = Collecting WWPN Pool Objects
collectServerPool = Collecting Server Pool Objects
collectQos = Collecting QoS Objects
collectDns = Collecting DNS Server Objects
collectNtp = Collecting NTP Server Objects
collectTimezone = Collecting Time Zone Objects
collectStatPol = Collecting Statistic Policy Objects
'@
}
# Override the default (en) if it exists in lang directory
Import-LocalizedData -BaseDirectory ($ScriptPath + "\lang") -BindingVariable pLang -ErrorAction SilentlyContinue
# Load UCS Powertool Module
If (!(Get-Module -name Cisco.UCSManager -ErrorAction SilentlyContinue)) {
Import-Module Cisco.UCSManager
If (!(Get-Module -name Cisco.UCSManager -ErrorAction SilentlyContinue)) {
Write-Error $pLang.loadModFailed
Throw
} Else {
Write-CustomOut $pLang.LoadModSuccess
}
}
# Clear Ucs Connections
Disconnect-Ucs
# Try connecting to specified domain
Try {
$password = "" | ConvertTo-SecureString -AsPlainText -Force
$UCSCredential = new-object -typename System.Management.Automation.PSCredential -argumentlist "svc_ucs_vcheck",$password
$UcsConnection = connect-ucs -name $UcsDomain -Credential $UCSCredential
} Catch {
Write-Error $pLang.connError
} Finally {
If ($UcsConnection) {
Write-CustomOut $pLang.connOpen
}
}
Write-CustomOut $pLang.collectDomain
$DomStatus = Get-UcsStatus
Write-CustomOut $pLang.collectSp
$SvcProfiles = Get-UcsServiceProfile -Type instance | Sort Name
Write-CustomOut $plang.collectSpTemplate
$SvcProfileTempls = Get-UcsServiceProfile | Where-object {$_.UuidSuffix -eq '0000-000000000000'} | Sort Name
Write-CustomOut $pLang.collectBlades
$Blades = Get-UcsBlade | Sort Name
Write-CustomOut $pLang.collectRackUnits
$RackUnits = Get-UcsRackUnit | Sort Name
Write-CustomOut $pLang.collectFi
$FabricInterconnects = Get-UcsNetworkElement | Sort Name
Write-CustomOut $pLang.collectPortLic
$APortLicenses = Get-UcsLicense | Where {$_.Scope -eq 'A'}
$BPortLicenses = Get-UcsLicense | Where {$_.Scope -eq 'B'}
Write-CustomOut $pLang.collectFiEth
$UplinkPorts = Get-UcsUplinkPort | Sort Rn
$UplinkPortChannels = Get-UcsUplinkPortChannel
Write-CustomOut $pLang.collectFiSan
$FcUplinkPorts = Get-UcsFcUplinkPort | Sort Rn
$FcUplinkPortChannels = Get-UcsUplinkPortChannel
Write-CustomOut $pLang.collectChassis
$Chassis = Get-UcsChassis | Sort Rn
Write-CustomOut $pLang.collectFaults
$Faults = Get-UcsFault | Sort Severity -Descending
Write-CustomOut $pLang.collectFirmware
$Firmware = Get-UcsFirmwareRunning
Write-CustomOut $pLang.collectKvm
$MgmtIpBlocks = @(Get-UcsIpPoolBlock | Where {$_.Dn -notlike '*iscsi*'})
$MgmtIpAddrs = @(Get-UcsIpPoolAddr)
Write-CustomOut $pLang.collectUuid
$UuidBlocks = @(Get-UcsUuidSuffixBlock)
$UuidPools = @(Get-UcsUuidSuffixPool | Where {$_.Size -ne 0})
Write-CustomOut $pLang.collectMac
$MacBlocks = @(Get-UcsMacMemberBlock)
$MacPools = @(Get-UcsMacPool | Where {$_.Size -ne 0})
Write-CustomOut $pLang.collectWwnBlock
$WwnBlocks = @(Get-UcsWwnMemberBlock)
Write-CustomOut $pLang.collectWwnnPool
$WwnnPools = @(Get-UcsWwnPool | Where {$_.Purpose -eq 'node-wwn-assignment' -AND $_.Size -ne 0})
#$WwnnAddrs = Get-UcsAdaptorHostFcIf | Select NodeWwn -Unique | Where-Object {$_.NodeWwn -ne '00:00:00:00:00:00:00:00'}
Write-CustomOut $pLang.collectWwpnPool
$WwpnPools = @(Get-UcsWwnPool | Where {$_.Purpose -eq 'port-wwn-assignment'-AND $_.Size -ne 0})
#$WwpnAddrs = Get-UcsAdaptorHostFcIf | Select Wwn -Unique | Where-Object {$_.NodeWwn -ne '00:00:00:00:00:00:00:00'}
Write-CustomOut $pLang.collectServerPool
$ServerPools = Get-UcsServerPool
$ServerPoolAssgns = Get-UcsServerPoolAssignment
Write-CustomOut $pLang.collectQos
$QosPolicies = Get-UcsQosPolicy
$QosClasses = Get-UcsQosClass
Write-CustomOut $pLang.collectDns
$DnsServers = Get-UcsDnsServer
Write-CustomOut $pLang.collectNtp
$NtpServers = Get-UcsNtpServer
Write-CustomOut $pLang.collectTimezone
$UcsTimezone = (Get-UcsTimeZone).OperTimezone
Write-CustomOut $pLang.collectStatPol
$StatCollPolicy = Get-UcsCollectionPolicy
Did you update the file '00 Connection Plugin for UCS.ps1'?
Or did you create the file $ScriptPath\Credentials\UcsCredentials.xml with the required credentials?
If that file is not there, the plugin will prompt for credentials which it will store in the file, and later use to connect.
I suspect it is that Get-Credential for which you are seeing the prompt.
But that should only happen once when the file doesn't exist yet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you, LucD.
Did you update the file '00 Connection Plugin for UCS.ps1'? - Yes, i entered the UCS domain name, but credential variable option unable to find.
Or did you create the file $ScriptPath\Credentials\UcsCredentials.xml with the required credentials? No, i didn't created. Can you please help me ? how to create the usercredntial.xml
Are you suggesting to use Get-Credential | Export-Clixml -Path 'C:\Reports\encrypted.xml' ?
Thanks
V
That file is created in folder Credentials in the root of the vCheck folder.
You can try to prepare this by running the following from the root of the vCheck folder
Get-Credential | Export-Clixml $UcsCredXml -Force
Check if that file Credentials\UcsCredentials.xml is there afterward.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
I did try using the following command suggested by you, but it throws an error. In fact, i have created the credential folder under vCheck folder root.
New-VICredentialStoreItem -Host ciscoucs -User "admin" -Password 'pass' -File D:\xyz\vCheck-UCS-master\Credentials\UcsCredentials.xml
Am i missing anything here ?
Thanks
Vk
The assignment should be a string, I corrected the code above.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes, no error this time after using using corrected code, but unfortunately it still prompt me for credential. Do, i need to give path in vCheck.ps1 for credential calling out ?
Can we do hard coding in vCheck.ps1 ? In worst case, i can enter credential in plaintext to run the report without any manual intervention.
Thanks
V
You can adapt plugin 00.
Replace the following lines
if (!(Test-Path -Path $UcsCredXml)) {
$null = New-Item -Path $UcsCredXml -ItemType File -Force
$null = Get-Credential | Export-Clixml $UcsCredXml -Force
}
# Import Credentials
$UcsCredentials = Import-Clixml $UcsCredXml
with these lines
$pswdStr = 'password'
$pswd = ConvertTo-securestring -String $pswdStr -AsPlainText -Force
$UcsCredentials = New-Object -typename PSCredential -ArgumentList $user,$pswd
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
My apologies for asking. Are you referring the below path to edit/replace ? Just to confirm, i don't see code..in connection Plugin for UCS or i need to edit my earlier code \Credentials\UcsCredentials.xml' ?
Thanks
Vk
That code is only present in the dev branch of vCheck-UCShttps://github.com/FooBartn/vCheck-UCS
It doesn't seem to be there is the master branch
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You need to do it in the file your pointing to. Below is what's working for me, the only difference is I'm converting the password in plaintext, to do it more securely you should be able to replace the bold part with LucD suggestions
$Title = "Connection settings for UCS"
$Author = "Joshua Barton, Alan Renouf"
$PluginVersion = 1.1
$Header = "Connection Settings"
$Comments = "Connection Plugin for connecting to Cisco UCS"
$Display = "List"
$PluginCategory = "UCS"
# Start of Settings
# Please Specify the hostname or IP address of the UCS Domain to connect to:
$UcsDomain = ""
# End of Settings
# Setup plugin-specific language table
$pLang = DATA {
ConvertFrom-StringData @'
loadModFail = Unable to load UCS Powertool Module. Please verify that it has been installed.
loadModSuccess = Successfully loaded Cisco UCS PowerTool
connOpen = Connecting to UCS Domain
connError = Unable to connect to UCS Domain, please verify address and credentials
collectDomain = Collecting UCS Domain Status
collectSp = Collecting Service Profile Objects
collectSpTemplate = Collecting Service Profile Template Objects
collectBlades = Collecting Blade Objects
collectRackUnits = Collecting RackUnit Objects
collectFi = Collecting Fabric Interconnect Objects
collectPortLic = Collecting Port License Objects
collectFiEth = Collecting FI Ethernet Port Objects
collectFiSan = Collecting FI SAN Port Objects
collectChassis = Collecting Chassis Objects
collectFaults = Collecting Fault Objects
collectFirmware = Collecting Infrastructure Firmware Object
collectKvm = Collecting KVM Management IP Objects
collectUuid = Collecting UUID Objects
collectMac = Collecting MAC Objects
collectWwnBlock = Collecting WWN Block Objects
collectWwnnPool = Collecting WWNN Pool Objects
collectWwpnPool = Collecting WWPN Pool Objects
collectServerPool = Collecting Server Pool Objects
collectQos = Collecting QoS Objects
collectDns = Collecting DNS Server Objects
collectNtp = Collecting NTP Server Objects
collectTimezone = Collecting Time Zone Objects
collectStatPol = Collecting Statistic Policy Objects
'@
}
# Override the default (en) if it exists in lang directory
Import-LocalizedData -BaseDirectory ($ScriptPath + "\lang") -BindingVariable pLang -ErrorAction SilentlyContinue
# Load UCS Powertool Module
If (!(Get-Module -name Cisco.UCSManager -ErrorAction SilentlyContinue)) {
Import-Module Cisco.UCSManager
If (!(Get-Module -name Cisco.UCSManager -ErrorAction SilentlyContinue)) {
Write-Error $pLang.loadModFailed
Throw
} Else {
Write-CustomOut $pLang.LoadModSuccess
}
}
# Clear Ucs Connections
Disconnect-Ucs
# Try connecting to specified domain
Try {
$password = "" | ConvertTo-SecureString -AsPlainText -Force
$UCSCredential = new-object -typename System.Management.Automation.PSCredential -argumentlist "svc_ucs_vcheck",$password
$UcsConnection = connect-ucs -name $UcsDomain -Credential $UCSCredential
} Catch {
Write-Error $pLang.connError
} Finally {
If ($UcsConnection) {
Write-CustomOut $pLang.connOpen
}
}
Write-CustomOut $pLang.collectDomain
$DomStatus = Get-UcsStatus
Write-CustomOut $pLang.collectSp
$SvcProfiles = Get-UcsServiceProfile -Type instance | Sort Name
Write-CustomOut $plang.collectSpTemplate
$SvcProfileTempls = Get-UcsServiceProfile | Where-object {$_.UuidSuffix -eq '0000-000000000000'} | Sort Name
Write-CustomOut $pLang.collectBlades
$Blades = Get-UcsBlade | Sort Name
Write-CustomOut $pLang.collectRackUnits
$RackUnits = Get-UcsRackUnit | Sort Name
Write-CustomOut $pLang.collectFi
$FabricInterconnects = Get-UcsNetworkElement | Sort Name
Write-CustomOut $pLang.collectPortLic
$APortLicenses = Get-UcsLicense | Where {$_.Scope -eq 'A'}
$BPortLicenses = Get-UcsLicense | Where {$_.Scope -eq 'B'}
Write-CustomOut $pLang.collectFiEth
$UplinkPorts = Get-UcsUplinkPort | Sort Rn
$UplinkPortChannels = Get-UcsUplinkPortChannel
Write-CustomOut $pLang.collectFiSan
$FcUplinkPorts = Get-UcsFcUplinkPort | Sort Rn
$FcUplinkPortChannels = Get-UcsUplinkPortChannel
Write-CustomOut $pLang.collectChassis
$Chassis = Get-UcsChassis | Sort Rn
Write-CustomOut $pLang.collectFaults
$Faults = Get-UcsFault | Sort Severity -Descending
Write-CustomOut $pLang.collectFirmware
$Firmware = Get-UcsFirmwareRunning
Write-CustomOut $pLang.collectKvm
$MgmtIpBlocks = @(Get-UcsIpPoolBlock | Where {$_.Dn -notlike '*iscsi*'})
$MgmtIpAddrs = @(Get-UcsIpPoolAddr)
Write-CustomOut $pLang.collectUuid
$UuidBlocks = @(Get-UcsUuidSuffixBlock)
$UuidPools = @(Get-UcsUuidSuffixPool | Where {$_.Size -ne 0})
Write-CustomOut $pLang.collectMac
$MacBlocks = @(Get-UcsMacMemberBlock)
$MacPools = @(Get-UcsMacPool | Where {$_.Size -ne 0})
Write-CustomOut $pLang.collectWwnBlock
$WwnBlocks = @(Get-UcsWwnMemberBlock)
Write-CustomOut $pLang.collectWwnnPool
$WwnnPools = @(Get-UcsWwnPool | Where {$_.Purpose -eq 'node-wwn-assignment' -AND $_.Size -ne 0})
#$WwnnAddrs = Get-UcsAdaptorHostFcIf | Select NodeWwn -Unique | Where-Object {$_.NodeWwn -ne '00:00:00:00:00:00:00:00'}
Write-CustomOut $pLang.collectWwpnPool
$WwpnPools = @(Get-UcsWwnPool | Where {$_.Purpose -eq 'port-wwn-assignment'-AND $_.Size -ne 0})
#$WwpnAddrs = Get-UcsAdaptorHostFcIf | Select Wwn -Unique | Where-Object {$_.NodeWwn -ne '00:00:00:00:00:00:00:00'}
Write-CustomOut $pLang.collectServerPool
$ServerPools = Get-UcsServerPool
$ServerPoolAssgns = Get-UcsServerPoolAssignment
Write-CustomOut $pLang.collectQos
$QosPolicies = Get-UcsQosPolicy
$QosClasses = Get-UcsQosClass
Write-CustomOut $pLang.collectDns
$DnsServers = Get-UcsDnsServer
Write-CustomOut $pLang.collectNtp
$NtpServers = Get-UcsNtpServer
Write-CustomOut $pLang.collectTimezone
$UcsTimezone = (Get-UcsTimeZone).OperTimezone
Write-CustomOut $pLang.collectStatPol
$StatCollPolicy = Get-UcsCollectionPolicy
Sejesse. It is working except the below error. Any idea how to fix ?
Thanks
VK
Does the report look fine, some of these vcheck reports can do that and still work correctly. That one may be fine, the report uses the vcheck framework, and may not apply the the ucs one.
Yes, report works fine. I disabled one of the plugin which error i.e. plugin not up to date or not installed. Now, it generates without any error.