Wednesday, 18 November 2020

How to create Power shell script class

 Step1: 


Below is the code script which we have to mention in power shell script file let say , example.ps1



class CommonInformation
{
[string]$folderName
}


[CommonInformation]$cInfo = [CommonInformation]::new()

$cInfo.folderName = Get-Date -Format 'yyyyMMdd_hh_mm_ss'

Write-Host $cInfo.folderName

No comments:

Post a Comment