23 lines
1.5 KiB
PowerShell
23 lines
1.5 KiB
PowerShell
$ErrorActionPreference='Stop'
|
|
"== post-reboot state =="
|
|
$pfro=(Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name PendingFileRenameOperations -ErrorAction SilentlyContinue).PendingFileRenameOperations
|
|
"PendingFileRenameOperations now: $([bool]$pfro)"
|
|
$os=Get-CimInstance Win32_OperatingSystem
|
|
"Last boot: $($os.LastBootUpTime) Uptime min: $([math]::Round(((Get-Date)-$os.LastBootUpTime).TotalMinutes,0))"
|
|
"Activation: $((Get-CimInstance SoftwareLicensingProduct -Filter "ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseStatus=1" | Select-Object -First 1 -Expand LicenseStatus) ) (1 = Licensed)"
|
|
|
|
"== create staging root + share (push target for pre-seed) =="
|
|
New-Item -ItemType Directory -Path 'C:\Share' -Force | Out-Null
|
|
if(Get-SmbShare -Name 'Share' -ErrorAction SilentlyContinue){ "share 'Share' already exists" } else {
|
|
New-SmbShare -Name 'Share' -Path 'C:\Share' -FullAccess 'TPS\Domain Admins','TPS\TPS-SERVER$' -CachingMode None | Out-Null
|
|
"created share 'Share'"
|
|
}
|
|
$acl=Get-Acl 'C:\Share'
|
|
foreach($id in @('TPS\Domain Admins','TPS\TPS-SERVER$','BUILTIN\Administrators','NT AUTHORITY\SYSTEM')){
|
|
$r=New-Object System.Security.AccessControl.FileSystemAccessRule($id,'FullControl','ContainerInherit,ObjectInherit','None','Allow'); $acl.AddAccessRule($r)
|
|
}
|
|
Set-Acl 'C:\Share' $acl
|
|
Get-SmbShareAccess -Name Share | Select-Object AccountName,AccessRight,AccessControlType | Format-Table -Auto | Out-String
|
|
"UNC ready: \\TPS-SVR\Share -> C:\Share"
|
|
"== DONE =="
|