Tag Archives | OSD

Using PowerShell to unpin the AppStore in Windows 10 – Workaround

I can’t find a way to unpin the AppStore in Windows 10. So I wen’t about it another way.
I reset the taskbar to have nothing and then I added everything back that I wanted.
I am using this in my OSD/RunOnce PowerShell script to customize the user’s desktop.

First of all I am using this function to manipulate the registry:

Function ChangeRegistry{
PARAM(
$ErrorActionPreference = "SilentlyContinue",
[Parameter(Mandatory=$true)]$registryPath,
[Parameter(Mandatory=$true)]$Name,
[Parameter(Mandatory=$true)]$Value ,
[Parameter(Mandatory=$true)]$PropertyType,
$Comment
)
Try {
 $RESULT=Get-ItemProperty -Path $registryPath -Name $Name | Out-Null
 New-ItemProperty -Path $registryPath -Name $Name -Value $Value -PropertyType $PropertyType -Force | Out-Null
}
Catch [System.Management.Automation.PSArgumentException] {
  New-ItemProperty -Path $registryPath -Name $Name -Value $Value -PropertyType $PropertyType -Force | Out-Null 
}
Catch [System.Management.Automation.ItemNotFoundException] {
  New-Item -Path $registryPath -Force | Out-Null
  New-ItemProperty -Path $registryPath -Name $Name -Value $Value -PropertyType $PropertyType -Force | Out-Null 
}
Finally { 
$ErrorActionPreference = "Continue" 
Write-host "$($Comment)$($Name): $Value"
}
}

Next I reset the Taskbar:

Write-Host "Setting up Start Menu" -ForegroundColor Green
ChangeRegistry -registryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "Favorites" -PropertyType "Binary" -Value ([byte[]](0xFF))
ChangeRegistry -registryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "FavoritesResolve" -PropertyType "Binary" -Value ([byte[]](0xFF))
ChangeRegistry -registryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "FavoritesChanges" -PropertyType "DWORD" -Value 0
ChangeRegistry -registryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "FavoritesVersion" -PropertyType "DWORD" -Value 1
Stop-Process -Name explorer -ErrorAction SilentlyContinue

Finally I use the InvokeVerb method to put back what I want:

$ShellApplication = New-Object -ComObject Shell.Application
$result=$ShellApplication.Namespace("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office").ParseName("Microsoft Outlook 2010.lnk").InvokeVerb("taskbarpin")

My offline Exchange 2010 install script

As I mentioned in my previos two posts, I am creating an offline replica of our Windows environment in order to test migrating from Exchange 2003 to Exchange 2010.  Now that I had a replica of our Exchange 2003 server running, I wanted to add a new Exchange 2010 box. I already had a SCCM OSD with 2008 R2 that installs the box and adds it to the domain (in this case it is the fully functioning offline domain). I added the new SP1 to meet all the prerequisites. Then I used the following commands:

#In powershell (I had to do it twice for some reason)
Import-Module ServerManager
Add-WindowsFeature NET-Framework,RSAT-ADDS,Web-Server,Web-Basic-Auth,Web-Windows-Auth,Web-Metabase,Web-Net-Ext,Web-Lgcy-Mgmt-Console,WAS-Process-Model,RSAT-Web-Server,Web-ISAPI-Ext,Web-Digest-Auth,Web-Dyn-Compression,NET-HTTP-Activation,RPC-Over-HTTP-Proxy -Restart

Set-service NetTcpPortSharing -startuptype automatic

.\setup.com /PrepareAD
.\setup.com /mode:install /roles:mb,ht,ca