Skip to content

Powershell Automation System, A collections of modules and scripts for Processing bunch of XML files to SQL database

Notifications You must be signed in to change notification settings

vishalbit14/Powershell.AutomationSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Powershell.AutomationSystem

Powershell Automation System has a collection of useful PowerShell modules and scripts. In Powershell.AutomationSystem, you can find mostly all the common functions for processing a XMLs files and transform into the SQL database. You can handle the whole process with the distinct to the Production and Stage database with either using of the DataTable or QueryStatements. Also, handle the logs files for the step by step process and adds the exception logs file when throws an any exception.

SQL-Modules

Please check below to the list of SQL modules overview and their usage.

Get-ConnectionString

Returns Database connection string either Production/Stage based on '$Stage' flag. Please click here to check parameter details.

Set-ConnectionString

Set the Connection string Globally of the Production and Staging and Get-ConnectionString function return the connection string. Please click here to check parameter details.

Open-SqlConnection

Open a new SQL Connection object based on the $Stage flag for the Stage or Production database. Please click here to check parameter details.

Close-SqlConnection

SQL Connection should be closed if no longer required. It will automatically handles and closed the current SQL connection when there is no longer needs. Please click here to check parameter details.

ExecuteNonQuery

Execute the INSERT, UPDATE, DELETE Statement or Store procedure. You can execute either SQL query or Procedure based on the functions parameters. Please click here to check parameter details.

ExecuteQueryResults

Execute the Query Statements or Stored procedure with parameter and returns a result. Please click here to check parameter details.

Write-BulkData

Insert the bulk data to SQL Server database tables. However, the data source is not limited to SQL Server; any data source can be used, as long as the data can be loaded to a DataTable instance or read with IDataReader instance. Please click here to check parameter details.

Common

Please check below to the list of Common modules overview and their usage.

Get-CountryCode

Get Country code from the string. However, The string can be either Address Line or full country name. Please click here to check parameter details and examples.

Initialize-ConfigSettings

Load the Default Settings of the System. Loading the Default Settings at the very begging of the system and can use the global settings to the whole system. Currently, Reading from the Config.json file. Where to mention all the resources, connections, and other configs. Please click here to check how to loads default configs and example for how to use configs.

Initialize-GlobalObjects

Initialize the global objects. However, we are using those objects while processing the bunch of XMLs files in one go. So, Global objects holds the table data until the save and clear once bunch of data save. Please click here to check how to intialize globals and example for how to use them.

Remove-OnRequest

Used for the remove files or folders from Explorer. However remove items from either directly using file path, files which contain a list of file paths, directory, and Object which contains a list of the path. Please click here to check parameter details and examples.

Write-Exception

Write the exception logs in the exception log file. When throws an exception in the system we are handling the write the exception message and stack trace in the exception log file. which is generating based on the current date. Please click here to check parameter details and examples.

Write-FilePathsFromDirectory

Write the list of paths into the text file from the directory. However, Get all child items from directory either from subfolders and writes the file paths into the given file location. Please click here to check parameter details and examples.

Write-LogInfo

Write the execution logs information into the log file. Write the step by step log information for the usage of tracking or keep as how the process goes on. We write the logs based on the needs and some messages only print in cmdlet to check the current status of the execution and important steps are written into the log file for later use. Please click here to check parameter details and examples.

Write-WatchLog

Write the exact time of the execution process. However, When starting the process $Timer would start and stop when process execution is finished. Also, Can able to add into the logs file as well based on the $Write flag. Please click here to check parameter details and examples.

Helper

Please check below to the list of Helper modules overview and their usage.

Create-Directory

Create a directory into the system. However, If given path directory does not exist into the system then create a new directory at given $Path. Please click here to check parameter details and examples.

Create-File

Create a file into the system. However, If given path file does not exist into the system then create a new file at given $Path. Please click here to check parameter details and examples.

Get-DateTimeFromString

Convert the date-time string into the DateTime. However, Parse the date from the $String and $Format and return DateTime. Note that, return $null if $String or $Format is not valid. Please click here to check parameter details and examples.

Get-FirstOrDefault

Select the First record from the list of the object. Please click here to check parameter details and examples.

Get-LastOrDefault

Select the Last record from the list of the object.. Please click here to check parameter details and examples.

Get-StringFromDateTime

Convert the DateTime into the string based on the $Date and $Format. Note that, return $null if $Date or $Format is not valid. Please click here to check parameter details and examples.

Get-SubString

Substring based on the Start and Length value of any string. However, Handling the Substring $null value and also used with the Default length. So, overwhelmed the exception in any of the cases. Please click here to check parameter details and examples.

Get-Type

Get the valid type from the TypeName string. Please click here to check parameter details and examples.

New-Date

Returns the date based format or default date format. $Format and other any of the. Please click here to check parameter details and examples.

Out-DataTable

Converts a Object list into the DataTable. Please click here to check parameter details and examples.

Reset-ToNull

Returns a $null. Used for the assign $null value to any properties. Please click here to check parameter details and examples.

Reset-ToNullIfEmpty

Returns a string or $null if empty. Please click here to check parameter details and examples.

Reset-ToValidInt

Returns $Value or 0 if value is $null. Please click here to check parameter details and examples.

Reset-ToValidString

Returns a string with fixing the single quote or empty string converting $Value. Please click here to check parameter details and examples.

Reset-ToZeroStringIfNull

Returns $Value or '0' if $Value is null or empty. Please click here to check parameter details and examples.

Controllers

Please check below to the list of Controllers modules overview and their usage.

Start-XMLFileProcess

A process on XML file for the inserting records in respective tables. However, Read the XML based on the nodes and calling the respective class and split the data into the class methods and assign it to the respective global table objects. Please click here to check parameter details and examples.

Save-DatabaseTableData

Call to Save data into the database to all Global objects here. Please click here to check parameter details and examples.

Public

Public is the starting point of the processing on XMLs. Calling from the AutomationSystem.Tests.ps1

Start-AutomationProcess

Call to Save data into the database to all Global objects here. Please click here to check parameter details and examples.

Config.json

Config.json holds all the system settings in json format. Currently, Stored configuration such as resources, connections, and other configs

Tests

Loads all the modules before start the process

AutomationSystem.Tests

Call to Save data into the database to all Global objects here. Please click here to check how to execute and parameter details.

Uploads

Uploads directory holds all the log informations of executions and exceptions.

About

Powershell Automation System, A collections of modules and scripts for Processing bunch of XML files to SQL database

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published