$Date = Get-date
$Registry = "Registry::HKLM\SOFTWARE\CompanyName"
$Registry1 = "Registry::HKLM\SOFTWARE\CompanyName\OperatingSystem"
$name = "OperatingSystem"
if (!(Test-Path -Path $Registry))
{
New-Item -Path $Registry -Force | Out-Null
New-Item -Path $Registry1 -Force | Out-Null
New-ItemProperty -LiteralPath $Registry1 -Name $name -Value $Date -PropertyType 'String' -Force | Out-Null
}
Elseif (!(Test-path -Path $Registry1))
{
New-Item -Path $Registry1 -Force | Out-Null
New-ItemProperty -LiteralPath $Registry1 -Name $name -Value $Date -PropertyType 'String' -Force | Out-Null
}
Else
{
New-ItemProperty -LiteralPath $Registry1 -Name $name -Value $Date -PropertyType 'String' -Force | Out-Null
}
No comments:
Post a Comment