Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[String]$Global:var=$args[0]----Inputs will come from Java in the below format
- $Global:var="ILITIES01,ILITIES01\Username1,Password1:ILITIES02,ILITIES02\Username2,Password2:ILITIES03,ILITIES03\Username3,Password3:"
- function LoadDllWithNoLock([string] $filePath)
- {
- $fileStream = ([IO.FileInfo] (Get-Item $filePath)).OpenRead();
- $assemblyBytes = new-object byte[] $fileStream.Length
- $fileStream.Read($assemblyBytes, 0, $fileStream.Length);
- $fileStream.Close();
- return [Reflection.Assembly]::Load($assemblyBytes);
- }
- function GetDecryptedString( [string] $encryptedString )
- {
- [string]$ec = 'eV5OuC0kd9f7g62hTemDbgTPNXms4emgkl51XDHnodg=';
- [string]$dk = [NextGen.Core.Cryptography.NGEncrypt]::DecryptAES( $ec, [NextGen.Core.Cryptography.NGEncrypt]::sNG_PASSWORD_KEY );
- [string]$decrypted = [NextGen.Core.Cryptography.NGEncrypt]::DecryptAES( $encryptedString, $dk );
- return $decrypted;
- }
- ############################# Client Info Details #########################################################
- function Get-ClinetInfo()
- {
- $global:ng_home = (get-childitem env:NEXTGEN_SHARE_HOME).value
- $global:confPath = "$global:ng_home\conf";
- $sharePropData = Get-Content "$confPath\share.properties";
- $global:shareProps = $sharePropData -join [Environment]::NewLine | ConvertFrom-StringData ;
- $global:DBUserName = $shareProps.'nga.database.username';
- $global:DBServerName = $shareProps.'nga.database.serverName';
- $nextgenCore = LoadDllWithNoLock -filePath "$ng_home\Rosetta\NextGen.Core.dll"
- [string]$global:dbpwd = GetDecryptedString -encryptedString $global:shareProps.'nga.database.password';
- $global:GCN = $shareProps.'share.gcn';
- $global:ShareSiteKey = $shareProps.'share.sitekey';
- ################################## OBJECT Creation for Client Info #############################################################
- $global:ClinetInfo_Object = New-Object PSObject -Property @{
- GCN = $GCN
- "SAP ID" = $null
- "SalesForce ID" = $null
- "ShareSiteKey" = $ShareSiteKey
- "Client Name" = $null
- "Site Name" = $null
- "Domain Name" = $null
- "Site Address" = $null
- }
- }
- ############################# License Info Details ###########################################################
- function Get-LicenseInfo()
- {
- $Global:encryptedKeys=New-Object System.Collections.ArrayList
- $global:ng_home = (get-childitem env:NEXTGEN_SHARE_HOME).value
- $global:confPath = "$global:ng_home\conf";
- $sharePropData = Get-Content "$confPath\share.properties";
- $global:shareProps = $sharePropData -join [Environment]::NewLine | ConvertFrom-StringData ;
- $global:DBUserName = $shareProps.'nga.database.username';
- $global:DBServerName = $shareProps.'nga.database.serverName';
- $nextgenCore = LoadDllWithNoLock -filePath "$ng_home\Rosetta\NextGen.Core.dll"
- [string]$global:dbpwd = GetDecryptedString -encryptedString $global:shareProps.'nga.database.password';
- $connectionString ="server=$DBServerName; uid=$DBUserName; pwd=$dbpwd;Integrated Security=False;"
- $connection = New-Object System.Data.SqlClient.SqlConnection -ErrorAction Stop
- $connection.ConnectionString = $connectionString
- $connection.Open()
- $query ="select license_key from NGProd.dbo.license_mstr"
- $command = $connection.CreateCommand()
- $command.CommandText = $query
- $result = $command.ExecuteReader()
- $dt = new-object System.Data.DataTable
- $dt.Load($result)
- $Global:LicenseKey=$dt.license_key
- foreach($key in $LicenseKey)
- {
- ################################## OBJECT Creation & DB Connection Closure for License Info #############################################################
- $global:LicenseInfo_Object = New-Object PSObject -Property @{
- "License Key" = "$Key"
- "Products Licensed" = 0
- "Active Date" = $null
- "Authorized By" = $null
- "Client Information" = $null
- "Customer Representative" = $null
- "Date Issued" = $null
- "Database Name" = $null
- "Expiry Date" = $null
- "Prod" = $null
- "Server Information" = $null
- "Version" = $null
- }
- $encryptedKeys.Add($global:LicenseInfo_Object)|Out-Null
- }
- $connection.Close()
- }
- ############################# Hardware Info Details ###########################################################
- Function Get-HardwareInfo()
- {
- # Remote System Information
- # Shows hardware and OS details from a list of PCs
- #[String]$var=$args[0]
- #$var="BLRVDILITIES01,BLRVDILITIES01\ITest,Pass@123:BLRVDILITIES02,BLRVDILITIES02\ITest,Pass@123:BLRVDILITIES03,BLRVDILITIES03\ITest,Pass@123:"
- $LocalNetwork=Get-WmiObject Win32_Computersystem
- ########### Iterative Function Call based on the number of Inputs in Args[0] ########
- function HardwareDetails($Computer,$cred)
- {
- if($LocalNetwork.Name -eq $computer){
- $computerSystem = Get-WmiObject -Class Win32_ComputerSystem
- $computerOS = Get-WmiObject -Class Win32_OperatingSystem
- $computerCPU = Get-WmiObject -Class Win32_Processor
- $computerHDDs = Get-WmiObject -Class Win32_LogicalDisk -filter "DriveType ='3'"
- $Network = Get-WmiObject Win32_NetworkAdapterConfiguration -filter "ipenabled = 'True'"
- $HotFix = Get-WmiObject -Class win32_quickfixengineering |?{$_.InstalledOn -ne $null} |sort InstalledOn -Descending | select HotFixID,Description,InstalledOn -First 1
- }
- else{
- $computerSystem = Get-WmiObject -Class Win32_ComputerSystem -Computer $Computer -cred $cred
- $computerOS = Get-WmiObject -Class Win32_OperatingSystem -Computer $Computer -cred $cred
- $computerCPU = Get-WmiObject -Class Win32_Processor -Computer $Computer -cred $cred
- $computerHDDs = Get-WmiObject -Class Win32_LogicalDisk -Computer $Computer -cred $cred -filter "DriveType ='3'"
- $Network = Get-WmiObject Win32_NetworkAdapterConfiguration -Computer $Computer -cred $cred -filter "ipenabled = 'True'"
- $HotFix = Get-WmiObject -Class win32_quickfixengineering -Computer $Computer -cred $cred |?{$_.InstalledOn -ne $null} |sort InstalledOn -Descending | select HotFixID,Description,InstalledOn -First 1
- }
- $logicalDisks = @()
- foreach($item in $computerHDDs)
- {
- $logicalDisk =[ordered]@{
- Name=$item.DeviceID -replace ':' ,'';
- DiskSize="{0:N2}" -f ($item.Size/1GB) + " GB";
- UsedSpace="{0:N2}" -f (($item.Size - $item.FreeSpace)/1GB) +" GB"
- }
- $logicalDisks +=$logicalDisk
- }
- if($computerCPU.Name -is [system.array]){
- $Processor = $computerCPU.Name[0]+" & "+($computerCPU.NumberOfLogicalProcessors[0]*$computerCPU.Name.count)
- }
- else{
- $Processor = $computerCPU.Name+" & "+$computerCPU.NumberOfLogicalProcessors
- }
- ############################# Hardware Info Object Creation based on the number of inputs in Args[0] ########################################
- $Hardware_Info_Object = [ordered] @{
- "Machine Name" =$Computer
- "IP Address" =$Network.IPAddress[0]
- "Processor" = $Processor
- "OS Version" =$computerOS.caption
- "Architecture"=$computerOS.OSArchitecture
- "ServicePack"=$computerOS.ServicePackMajorVersion
- "Physical Memory" = "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB) + " GB"
- "PhysicalDisk Spaces" =$logicalDisks
- "OS HotFix" = $HotFix
- }
- return $Hardware_Info_Object
- }
- try
- {
- $var1=$var.Remove($var.Length -1)
- $parameter= @($var1)
- $Splitted= $parameter -split ':'
- $Length=$Splitted.Length
- # $arrCredentials = $parameter -split ','
- [int32]$i=0;
- foreach ($splits in $Splitted)
- {
- if($i -lt $Length)
- {
- $array=$splits.split(',')
- $computer=$array[0]
- $username = $array[1]
- $password = $array[2]
- $secstr = New-Object -TypeName System.Security.SecureString
- $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
- $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
- HardwareDetails $computer $cred
- $i++
- }
- }
- }
- catch
- {
- getErrorMessage
- }
- }
- ############################# Version Info Details ###########################################################
- Function Get-VersionInfo()
- {
- $global:ng_home = (get-childitem env:NEXTGEN_SHARE_HOME).value
- $global:confPath = "$global:ng_home\conf";
- $sharePropData = Get-Content "$confPath\share.properties";
- $global:shareProps = $sharePropData -join [Environment]::NewLine | ConvertFrom-StringData ;
- $global:DBUserName = $shareProps.'nga.database.username';
- $global:DBServerName = $shareProps.'nga.database.serverName';
- $nextgenCore = LoadDllWithNoLock -filePath "$ng_home\Rosetta\NextGen.Core.dll"
- [string]$global:dbpwd = GetDecryptedString -encryptedString $global:shareProps.'nga.database.password';
- $connectionString ="server=$DBServerName; uid=$DBUserName; pwd=$dbpwd;Database='NGProd';Integrated Security=False;"
- $connection = New-Object System.Data.SqlClient.SqlConnection -ErrorAction Stop
- $connection.ConnectionString = $connectionString
- $connection.Open()
- ######################## KBM Version ##########################################
- $locationquery = “select distinct TOP 1 Description,version from version limit where product_id like '%KBM%' order by version desc"
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- $global:loc = $locationdt.Version
- ########################## Rosetta Branch Version ##################################
- $locationquery = “select option_value AS Branch from configuration_options where instance_name like '%Version.Rosetta%' and key_name like '%Branch%'"
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- $global:loc2 = $locationdt.Branch
- ########################### Rosetta Build Version ###################################
- $locationquery = “select option_value AS Build from configuration_options where instance_name like '%Version.Rosetta%' and key_name like '%Build%'"
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- $global:loc3 = $locationdt.Build
- ########################### DASHBOARD Version #########################################
- $locationquery = “select * from version where product_id='DASHHSP' order by 8 desc"
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- $global:dashboard = $locationdt.version
- ####################### NGShare Version & HotFix #############################################################
- $locationquery = “create table #temp_version
- (
- Product_id char(10),
- version varchar(20),
- description varchar(80),
- modify_timestamp datetime
- )
- "
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- $locationquery = “insert into #temp_version select distinct TOP 1 Product_id,version,Description,modify_timestamp from version where Product_id like '%HF%' and description like '%NextGen%' order by modify_timestamp ;"
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- $locationquery = “insert into #temp_version select distinct TOP 1 Product_id,version,Description,modify_timestamp from version where description like '%NextGen Package%' order by version desc ;"
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- $locationquery = “select top 1 * from #temp_version order by modify_timestamp; "
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- $loc11 = $locationdt
- If ($loc11.Product_Id -match "HF*")
- {$global:loc12 = $loc11.Description}
- else
- {$global:loc12 = $loc11.Version}
- # "value 4 $global:loc4"
- $locationquery = “drop table #temp_version "
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- ################################## OBJECT Creation & DB Connection Closure for Version Info #############################################################
- $global:VersionInfo_Object = New-Object PSObject -Property @{
- "NextGen Ambulatory EHR" = "$loc12"
- "NextGen Practice Management" = "$loc12"
- "NextGen Dashboard" = "$dashboard"
- "NextGen Document Management" = "$loc12"
- "NextGen Knowledge Base Module" = "$loc"
- "Pophealth" = $null
- "eRx" = $null
- "NextGen Background Business Processes" = "$loc12"
- "NextGen Appointment Scheduling" = "$loc12"
- "NextGen Real-Time Edits(NG RTE)" = "$loc12"
- "NextGen CHC Reporting Module" = $null
- "NextGen Optical Management" = "$loc12"
- "NextGen Real Time Services" = "$loc12"
- "NextGen Remote Patient Chart Synchronization" = "$loc12"
- "NextGen RTF Document Import" = "$loc12"
- "Case Management" = "$loc12"
- "Enterprise Case" = "$loc12"
- "Enterprise Chart" = "$loc12"
- "Rosetta Holding Tank(Build)" = "$loc3"
- "Rosetta Holding Tank(Branch)" = "$loc2"
- "Provider Approval queue" = "$loc12"
- }
- $connection.Close()
- }
- ############################# Interop Services Details ########################################################
- Function Get-InteropServices()
- {
- $global:ng_home = (get-childitem env:NEXTGEN_SHARE_HOME).value
- $global:confPath = "$global:ng_home\conf";
- $sharePropData = Get-Content "$confPath\share.properties";
- $global:shareProps = $sharePropData -join [Environment]::NewLine | ConvertFrom-StringData ;
- $global:DBUserName = $shareProps.'nga.database.username';
- $global:DBServerName = $shareProps.'nga.database.serverName';
- $nextgenCore = LoadDllWithNoLock -filePath "$ng_home\Rosetta\NextGen.Core.dll"
- [string]$global:dbpwd = GetDecryptedString -encryptedString $global:shareProps.'nga.database.password';
- $connectionString ="server=$DBServerName; uid=$DBUserName; pwd=$dbpwd;Database='NGProd';Integrated Security=False;"
- $connection = New-Object System.Data.SqlClient.SqlConnection -ErrorAction Stop
- $connection.ConnectionString = $connectionString
- $connection.Open()
- ##################### NGShare Installed or Not #####################################
- If((get-childitem env:NEXTGEN_SHARE_HOME).value)
- {
- $locationquery = “SELECT key_name FROM configuration_options WHERE app_name = 'NGSHARE ' AND instance_name = 'NextGenShare.Service'"
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- $global:loc4 = $locationdt
- If($global:loc4)
- {
- $global:loc5="Installed"
- }
- }
- else {$global:loc5="Not Installed"}
- ####################### Patient Portal Installed or Not ###############################
- $locationquery = “select pl.user_id, pl.preference_id, pl.preference_value,
- p.preference_name, p.group_id, p.preference_type, p.value_type
- from preference_list pl, preferences p
- where pl.preference_id = p.preference_id and pl.user_id= -1 and p.preference_id in (707)
- "
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- $global:loc6 = $locationdt
- If($loc6)
- {$global:loc7="Active"} else{$global:loc7="InActive"}
- ########################## HQM Installed or Not ########################################
- If((Get-Service | ? {$_.Name -like 'HQMDataPush*'}) -and (Get-Service -ComputerName blrvdilities02 | ? {$_.Name -like 'HQMWatchDog*'}))
- {$Global:hqmversion="Installed"}
- else{$Global:hqmversion="Not Installed"}
- ################################## OBJECT Creation & DB Connection Closure for Interop Services #############################################################
- $global:InteropServices_Object = New-Object PSObject -Property @{
- "NgShare Version & hotfix" = "$loc5"
- "Patient Portal version and hotfix" = "$loc7"
- "HQM version & hotfix" = "$hqmversion"
- }
- $connection.Close()
- }
- ############################# System Version Details ######################################################
- Function Get-SystemVersionDetails()
- {
- $Global:myArray = New-Object System.Collections.ArrayList
- function SysVersionDetails($Computer,$cred)
- {
- if((Get-WmiObject win32_computersystem).Name -eq $Computer)
- {
- #--------------JAVA If Machine is local------------------------#
- If($java_version=dir "HKLM:\SOFTWARE\JavaSoft\Java Runtime Environment" | select -expa pschildname -Last 1)
- {$Global:java_version|Out-Null}
- else{$Global:java_version=$null}
- #--------------DOTNET If Machine is local------------------------#
- If($DotNet_version = gci 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' | sort pschildname -des |select -fi 1 -exp pschildname)
- {$Global:DotNet_version|Out-Null}
- else{$Global:DotNet_version = $null}
- }
- #"printing the value of $computer"
- ##### JAVA Version ############
- else
- {
- If($java_version=Invoke-command -ComputerName $computer -Credential $cred -ScriptBlock {dir "HKLM:\SOFTWARE\JavaSoft\Java Runtime Environment" | select -expa pschildname -Last 1})
- #Get-WmiObject -Class Win32_Product -ComputerName $computer -Credential $cred -Filter "Name like 'Java%'" | Select -Expand Version)
- {$Global:java_version|Out-Null}
- else{$Global:java_version=$null}
- ##### DOTNET Version ############
- If($DotNet_version = Invoke-command -ComputerName $computer -Credential $cred -ScriptBlock {gci 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' | sort pschildname -des |select -fi 1 -exp pschildname})
- #(Get-WmiObject win32_product -ComputerName $computer -Credential $cred | ?{$_.Name -like "Microsoft .NET Framework*"}).Version)
- {$Global:DotNet_version|Out-Null}
- else{$Global:DotNet_version = $null}
- }
- ############# Object Creation for System Version Details #########################
- $Global:System_Version_Object = [PSCustomObject]@{
- "Machine Name" = [String]$computer
- "Java Version" = [String]$java_version
- "DotNet Version" = [String]$DotNet_version
- }
- ##-------------- End of Internal Function --------------##
- }
- try
- {
- $ErrorActionPreference = 'SilentlyContinue'
- $var1=$var.Remove($var.Length -1)
- $parameter= @($var1)
- $Splitted= $parameter -split ':'
- $Length=$Splitted.Length
- # $arrCredentials = $parameter -split ','
- [int32]$i=0;
- foreach ($splits in $Splitted)
- {
- if($i -lt $Length)
- {
- $array=$splits.split(',')
- $Global:computer=$array[0]
- $username = $array[1]
- $password = $array[2]
- $secstr = New-Object -TypeName System.Security.SecureString
- $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
- $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
- SysVersionDetails $computer $cred
- $myArray.Add($System_Version_Object) | Out-Null
- $i++
- }
- }
- ######################### DB PART for SQL Server Version ##########################################
- $global:ng_home = (get-childitem env:NEXTGEN_SHARE_HOME).value
- $global:confPath = "$global:ng_home\conf";
- $sharePropData = Get-Content "$confPath\share.properties";
- $global:shareProps = $sharePropData -join [Environment]::NewLine | ConvertFrom-StringData ;
- $global:DBUserName = $shareProps.'nga.database.username';
- $global:DBServerName = $shareProps.'nga.database.serverName';
- $nextgenCore = LoadDllWithNoLock -filePath "$ng_home\Rosetta\NextGen.Core.dll"
- [string]$global:dbpwd = GetDecryptedString -encryptedString $global:shareProps.'nga.database.password';
- $connectionString ="server=$DBServerName; uid=$DBUserName; pwd=$dbpwd;Database='NGProd';Integrated Security=False;"
- $connection = New-Object System.Data.SqlClient.SqlConnection -ErrorAction Stop
- $connection.ConnectionString = $connectionString
- $connection.Open()
- $locationquery = “select @@Version as Version"
- $locationcommand = $connection.CreateCommand()
- $locationcommand.CommandText = $locationquery
- $locationresult = $locationcommand.ExecuteReader()
- $locationdt = new-object “System.Data.DataTable”
- $locationdt.Load($locationresult)
- $global:sqlversion = $locationdt.Version
- ###--------------- SQL Object Creation and adding it to the arraylist --------------------###
- $Global:SQL_Version_Object = [PSCustomObject]@{
- "SQL Version" = [String]$sqlversion }
- $myArray.Add($SQL_Version_Object) | Out-Null
- }
- catch
- {
- $Exception= $_.Exception.Message
- }
- }
- ################################### Network Details ########################################################
- Function Get-NetworkDetails()
- {
- $Global:myArrayfornetwork1=New-Object System.Collections.ArrayList
- ###-- Internal Function ---------######
- function Get-StatusFromValue($Global:computer,$cred)
- {"Writing logs"
- if((Get-WmiObject win32_computersystem).Name -eq $Computer)
- {
- "Inside Network If"
- $Global:Network_Details=Get-WmiObject -Class win32_networkadapter |Select-Object Name,NetConnectionId,AdapterType,Speed
- }
- else
- {
- "Inside Network Else"
- $Global:Network_Details=Get-WmiObject -Class win32_networkadapter -computer $computer -Credential $cred |Select-Object Name, NetConnectionId,AdapterType,Speed
- }
- #####--- Object for Network ----------#############
- foreach($network in $Network_Details)
- {"Inside Foreach loop" +$network.Name
- $Global:name=$network.Name
- $Global:Adapter=$network.AdapterType
- $Global:speed=$network.Speed
- $Global:cid=$network.NetConnectionId
- $GLobal:machine_name= $Computer
- $Global:Network_Object_Details = [PSCustomObject]@{
- "Name" = $Name
- "AdapterType" = $adapter
- "Speed(bps)" =$speed
- "NetConnectionID" = $cid
- }
- }
- $Global:Network_Object = [PSCustomObject]@{
- "Machine Name" =$machine_name
- "Network Details" = $Network_Object_Details
- }
- $myArrayfornetwork1.Add($Network_Object)
- }#end Get-StatusFromValue function
- # *** Entry point to script ***
- try
- {
- $ErrorActionPreference = 'SilentlyContinue'
- $var1=$var.Remove($var.Length -1)
- $parameter= @($var1)
- $Splitted= $parameter -split ':'
- $Length=$Splitted.Length
- # $arrCredentials = $parameter -split ','
- [int32]$i=0;
- foreach ($splits in $Splitted)
- {
- if($i -lt $Length)
- {
- $array=$splits.split(',')
- $Global:computer=$array[0]
- $username = $array[1]
- $password = $array[2]
- $secstr = New-Object -TypeName System.Security.SecureString
- $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
- $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
- Get-StatusFromValue $computer $cred
- #$myArrayfornetwork.Add($Network_Object) | Out-Null
- $i++
- }
- }
- }
- catch
- {$Exception_Message = $_.Exception.Message}
- }
- ############################### Error Message Function to catch the Exceptions ##################################
- function Get-ErrorMessage()
- {
- $error_object = [ordered] @{
- machineName =$server
- Error =$_.Exception.Message
- }
- $errorMessage=ConvertTo-Json $error_object -depth 4 -compress
- return $errorMessage
- }
- #################################### Main Script Block ############################################################
- #################################### try block for calling all the functions and creating the final Object ############################
- try
- {
- <#
- $global:out1
- workflow trigger-functions {
- parallel {
- $Using:out1= InlineScript {Get-ClinetInfo}
- InlineScript {Get-LicenseInfo}
- InlineScript {Get-VersionInfo}
- Checkpoint-Workflow
- "my out 1 is $out1"
- }
- trigger-functions
- }#>
- Get-ClinetInfo
- Get-LicenseInfo
- Get-VersionInfo
- Get-InteropServices
- Get-SystemVersionDetails
- Get-NetworkDetails
- #$hardware_values=Get-HardwareInfo
- $global:Core_Object = New-Object PSObject -Property @{
- "Client Details" = $ClinetInfo_Object
- "License Details" = $encryptedKeys
- "Hardware Details" = Get-HardwareInfo
- "Network Details" = $myArrayfornetwork1
- "Version Details" = $VersionInfo_Object
- "Interop Services" = $InteropServices_Object
- "SystemVersion Details" = $myArray
- }
- ############################# JSON Conversion ###########################################################
- $Core_Object | ConvertTo-Json -Depth 12 -Compress
- }
- ########################### Catch Block for capturing the Error ######################################################
- Catch
- {
- Get-ErrorMessage
- }
Add Comment
Please, Sign In to add comment