Commit 305503da authored by mseng3's avatar mseng3
Browse files

Update smsts-post-action.ps1

parent 1faccc40
......@@ -92,10 +92,19 @@ log "Setting window title to $windowtitle...".
$host.ui.RawUI.WindowTitle = $windowtitle
# Adds current date to registry key for tracking purposes
$date = get-date -uformat %Y-%m-%d
log "Writing image date ($date) to registry (HKLM\System\Image\ImageDate) for tracking purposes..."
$date = get-date -uformat "%Y-%m-%d"
log "Writing image date ($date) to registry (HKLM:\System\Image\ImageDate) for tracking purposes..."
reg add HKLM\System\Image /v ImageDate /t REG_SZ /d "$date" /f
# Modernized reg key addition
$regKey = "HKLM:\System\EngrIT"
$regValueName = "ImageDate"
$regValueType = "String" # i.e. REG_SZ
$regValueData = get-date -uformat "%Y-%m-%d_%H-%M-%S"
log "Writing image date ($regValueData) to registry ($regKey\$regValueName) for tracking purposes..."
New-Item -Path $regKey # If exists, will fail and not overwrite anything, which is what we want
New-ItemProperty -Path $regKey -Name $regValueName -PropertyType $regValueType -Value $regValueData -Force # If exists, will overwrite
# updates GPOs
# If a user logs in before the gpupdate finishes, and the gpupdate requires a relog/restart, this script can hang, waiting for the user to type y or n, even though the cmd window is invisible. Piping "echo n" here solves this.
log "Running gpupdate /force..."
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment