first commit
This commit is contained in:
BIN
HJLaw.ppkg
Normal file
BIN
HJLaw.ppkg
Normal file
Binary file not shown.
35
hjinstall.ps1
Normal file
35
hjinstall.ps1
Normal file
@@ -0,0 +1,35 @@
|
||||
function Join-HJLaw
|
||||
{
|
||||
param(
|
||||
[string]$DeviceName
|
||||
)
|
||||
|
||||
if (-not $DeviceName -eq "")
|
||||
{
|
||||
Rename-Computer -NewName $DeviceName
|
||||
}
|
||||
$ppkg = $false
|
||||
Get-ProvisioningPackage -AllInstalledPackages | ForEach-Object {
|
||||
if($_.PackagePath -like "*HJLaw*")
|
||||
{
|
||||
if ($_.IsInstalled)
|
||||
{
|
||||
$ppkg = $true
|
||||
}
|
||||
}
|
||||
}
|
||||
if (-not $ppkg)
|
||||
{
|
||||
$registryPath = "HKLM:\SOFTWARE\Microsoft\Enrollments"
|
||||
$subKeys = Get-ChildItem -Path $registryPath
|
||||
foreach ($subKey in $subKeys)
|
||||
{
|
||||
Remove-Item -Path "$registryPath\$($subKey.PSChildName)" -Recurse -Force
|
||||
}
|
||||
dsregcmd /leave
|
||||
Uninstall-ProvisioningPackage -AllInstalledPackages
|
||||
|
||||
Install-ProvisioningPackage -PackagePath '.\HJLaw.ppkg' -QuietInstall -Force
|
||||
dsregcmd /status
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user