Windows 10 开始菜单布局基线,磁贴缺失
Windows 10 Startmenu Layout Baseline, tile missing
我已经为我的 windows 10 个部署创建了一个基线,它将 StartMenu 设置为默认布局。 (由于一些内部政治,我不得不将其作为基准,所以不要问 :-)。)
此基线创建一个 XML 文件,其中包含从之前通过 Powershell 导出的开始菜单中捕获的数据。该脚本可以正常工作并且可以毫无问题地完成它应该做的事情。但是,当我使用新帐户登录时,开始菜单中缺少 IE 磁贴。该脚本在“%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs”处创建了缺少的快捷方式,正如我在其他几页上所读到的那样。但是这个修复似乎对我不起作用。
此脚本还删除了 windows 10 新用户欢迎视频。
这是脚本:
$key = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
$filecontent = @"
<LayoutModificationTemplate Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6" xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout">
<start:Group Name="General Apps" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="1x1" Column="2" Row="1" AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />
<start:Tile Size="1x1" Column="3" Row="1" AppUserModelID="Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI" />
<start:DesktopApplicationTile Size="1x1" Column="2" Row="0" DesktopApplicationID="Microsoft.SoftwareCenter.DesktopToasts" />
<start:Tile Size="1x1" Column="4" Row="1" AppUserModelID="Microsoft.WindowsStore_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="1x1" Column="4" Row="0" DesktopApplicationID="{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\SnippingTool.exe" />
<start:Tile Size="1x1" Column="5" Row="0" AppUserModelID="Microsoft.People_8wekyb3d8bbwe!x4c7a3b7dy2188y46d4ya362y19ac5a5805e5x" />
<start:Tile Size="1x1" Column="3" Row="0" AppUserModelID="Microsoft.WindowsCalculator_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="1x1" Column="0" Row="0" DesktopApplicationID="Microsoft.InternetExplorer.Default" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="2x2" Column="0" Row="0" AppUserModelID="Microsoft.BingWeather_8wekyb3d8bbwe!App" />
<start:Tile Size="2x2" Column="2" Row="0" AppUserModelID="Microsoft.BingNews_8wekyb3d8bbwe!AppexNews" />
</start:Group>
<start:Group Name="Remote Tools" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Windows.RemoteDesktop" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="Juniper.Junos Pulse.UserInterface" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Office.OUTLOOK.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="Microsoft.Office.WINWORD.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationID="Microsoft.Office.EXCEL.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationID="Microsoft.Office.lync.exe.15" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="2" DesktopApplicationID="Microsoft.Office.ONENOTE.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="2" DesktopApplicationID="Microsoft.Office.POWERPNT.EXE.15" />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
"@
<# Remove Weclome Video #>
$res = Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -ErrorAction SilentlyContinue
if (-not $res)
{New-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -value "0" -PropertyType "DWord"}
else
{Set-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -value "0"}
<# Load XML Data #>
New-Item $env:ProgramData\testing\menulayout -ItemType directory
echo $filecontent |out-file $env:ProgramData\lmco\menulayout\LayoutModification.xml
Import-StartLayout -LayoutPath $env:ProgramData\lmco\menulayout\LayoutModification.xml -MountPath $env:SystemDrive\
<# Add IE Shorcut #>
$TargetFile = "C:\Program Files\Internet Explorer\iexplore.exe"
$ShortcutFile = "$env:ALLUSERSPROFILE\Microsoft\Windows\Start Menu\Programs\Internet Explorer 11.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
$Shortcut.TargetPath = $TargetFile
$Shortcut.Save()
<# Cleanup #>
Remove-Item $env:ProgramData\testing\menulayout -Recurse -Force
只是想知道是否有人可以对此进行测试,看看他们是否会得到相同的结果。或者即使有人找到了如何显示丢失的瓷砖。
如果我使用 <start:DesktopApplicationTile Size="1x1" Column="0" Row="0" DesktopApplicationID="%appdata%\Microsoft\Windows\Start Menu\Programs\Internet Explorer.lnk" />
之类的东西将磁贴设置为硬链接快捷方式,我最终会完全破坏用户的开始菜单。
我还发现,当我仅对 IE 行进行更改时,Store Tile 偶尔会从一开始就消失,所以我得到了一些奇怪的结果。
此外,当我 运行 对刚登录的用户执行 export-startlayout 时,我可以看到开始菜单 xml 没有丢失图块的记录。
而且我也尝试过使用实际的 XML 文件导入,我得到了相同的结果 运行 手工输入 2 行。
这是脚本的最终版本。遗憾的是最终没有使用它,但很高兴让它工作。
<# Detect Office Version #>
$office2013 = (Get-ItemProperty "HKLM:\Software\Microsoft\Office.0\Outlook" -ErrorAction SilentlyContinue)
$office2016 = (Get-ItemProperty "HKLM:\Software\Microsoft\Office.0\Outlook" -ErrorAction SilentlyContinue)
if($office2013) {$officeversion = "2013"}
if($office2016) {$officeversion = "2016"}
<# Reg Values #>
$key = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
<# XML Data 2016 #>
if ($officeversion -eq 2016) {
$filecontent = @"
<LayoutModificationTemplate Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6" xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout">
<start:Group Name="General Apps" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="1x1" Column="2" Row="1" AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />
<start:Tile Size="1x1" Column="3" Row="1" AppUserModelID="Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI" />
<start:DesktopApplicationTile Size="1x1" Column="2" Row="0" DesktopApplicationID="Microsoft.SoftwareCenter.DesktopToasts" />
<start:Tile Size="1x1" Column="4" Row="1" AppUserModelID="Microsoft.WindowsStore_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="1x1" Column="4" Row="0" DesktopApplicationID="{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\SnippingTool.exe" />
<start:Tile Size="1x1" Column="5" Row="0" AppUserModelID="Microsoft.People_8wekyb3d8bbwe!x4c7a3b7dy2188y46d4ya362y19ac5a5805e5x" />
<start:Tile Size="1x1" Column="3" Row="0" AppUserModelID="Microsoft.WindowsCalculator_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="{6D809377-6AF0-444B-8957-A3773F02200E}\Internet Explorer\iexplore.exe" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="2x2" Column="0" Row="0" AppUserModelID="Microsoft.BingWeather_8wekyb3d8bbwe!App" />
<start:Tile Size="2x2" Column="2" Row="0" AppUserModelID="Microsoft.BingNews_8wekyb3d8bbwe!AppexNews" />
</start:Group>
<start:Group Name="Remote Tools" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Windows.RemoteDesktop" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="Juniper.Junos Pulse.UserInterface" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Office.OUTLOOK.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="Microsoft.Office.WINWORD.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationID="Microsoft.Office.EXCEL.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationID="Microsoft.Office.lync.exe.15" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="2" DesktopApplicationID="Microsoft.Office.ONENOTE.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="2" DesktopApplicationID="Microsoft.Office.POWERPNT.EXE.15" />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
"@
}
<# XML Data 2013 #>
if ($officeversion -eq 2013) {
$filecontent = @"
<LayoutModificationTemplate Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6" xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout">
<start:Group Name="General Apps" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="1x1" Column="2" Row="1" AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />
<start:Tile Size="1x1" Column="3" Row="1" AppUserModelID="Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI" />
<start:DesktopApplicationTile Size="1x1" Column="2" Row="0" DesktopApplicationID="Microsoft.SoftwareCenter.DesktopToasts" />
<start:Tile Size="1x1" Column="4" Row="1" AppUserModelID="Microsoft.WindowsStore_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="1x1" Column="4" Row="0" DesktopApplicationID="{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\SnippingTool.exe" />
<start:Tile Size="1x1" Column="5" Row="0" AppUserModelID="Microsoft.People_8wekyb3d8bbwe!x4c7a3b7dy2188y46d4ya362y19ac5a5805e5x" />
<start:Tile Size="1x1" Column="3" Row="0" AppUserModelID="Microsoft.WindowsCalculator_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="{6D809377-6AF0-444B-8957-A3773F02200E}\Internet Explorer\iexplore.exe" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="2x2" Column="0" Row="0" AppUserModelID="Microsoft.BingWeather_8wekyb3d8bbwe!App" />
<start:Tile Size="2x2" Column="2" Row="0" AppUserModelID="Microsoft.BingNews_8wekyb3d8bbwe!AppexNews" />
</start:Group>
<start:Group Name="Remote Tools" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Windows.RemoteDesktop" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="Juniper.Junos Pulse.UserInterface" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Office.OUTLOOK.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Microsoft Office\Office15\WINWORD.EXE" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationID="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Microsoft Office\Office15\EXCEL.EXE" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationID="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Microsoft Office\Office15\lync.exe" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="2" DesktopApplicationID="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Microsoft Office\Office15\POWERPNT.EXE" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="2" DesktopApplicationID="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Microsoft Office\Office15\ONENOTE.EXE" />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
"@
}
<# Remove Weclome Video #>
$res = Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -ErrorAction SilentlyContinue
if (-not $res)
{New-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -value "0" -PropertyType "DWord"}
else
{Set-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -value "0"}
<# Load XML Data #>
$folderexist = (test-path $env:ProgramData\lmco\)
if ($folderexist)
{New-Item $env:ProgramData\lmco\menulayout -ItemType directory}
else
{New-Item $env:ProgramData\LMCO\ -ItemType directory; New-Item $env:ProgramData\lmco\menulayout -ItemType directory}
echo $filecontent |out-file $env:ProgramData\lmco\menulayout\LayoutModification.xml
Import-StartLayout -LayoutPath $env:ProgramData\lmco\menulayout\LayoutModification.xml -MountPath $env:SystemDrive\
<# Add IE Shorcut #>
$TargetFile = "C:\Program Files\Internet Explorer\iexplore.exe"
$ShortcutFile = "$env:ALLUSERSPROFILE\Microsoft\Windows\Start Menu\Programs\Internet Explorer.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
$Shortcut.TargetPath = $TargetFile
$Shortcut.Save()
<# Cleanup #>
Remove-Item $env:ProgramData\lmco\menulayout -Recurse -Force
我自己在应用程序中遇到了一些 IE 问题。据我所知,Microsoft.InternetExplorer.Default 似乎不起作用,虽然一些指南说 Microsoft.Explorer.Default 对 IE 有效,但这可以追溯到一篇原始 technet 文章中的拼写错误。我使用捕获的非通用 AppID 使其工作
{6D809377-6AF0-444B-8957-A3773F02200E}\Internet Explorer\iexplore.exe
64 位和
{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Internet Explorer\iexplore.exe
32 位。您可以使用 Powershell 命令 'Get-StartApps' 为所有可能的程序获取此 ID,因此:
Get-StartApps | where {$_.Name -ilike 'Internet Explorer*'}
如果 IE 坏了,只获取它。如您所见,here 这些是 ProgramFilesx64 和 x86 文件夹的 GUID。还有一个用于 ProgramFiles 的通用文件 ({905E63B6-C1BF-494E-B29C-65B732D3D21A}),但由于它未与 Get-StartApps 一起列出,因此可能无法使用。
然而,首先这个解决方案不适用于 x64 和 x86 windows 一个文件,其次对我来说似乎它可能会在某个时候中断。这不太可能,因为存在 ID,因为 vista 和更改 GUID 会破坏很多兼容性,但我仍然宁愿不依赖更晦涩的方法,只要有替代方法。
因此我选择了使用 lnk 文件的解决方案。如果你这样做了,你就不能再使用 DesktopApplicationID
,而是 DesktopApplicationLinkPath
。正确的语法应该是:
<start:DesktopApplicationTile Size="1x1" Column="0" Row="0" DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\Internet Explorer.lnk" />
我已经为我的 windows 10 个部署创建了一个基线,它将 StartMenu 设置为默认布局。 (由于一些内部政治,我不得不将其作为基准,所以不要问 :-)。)
此基线创建一个 XML 文件,其中包含从之前通过 Powershell 导出的开始菜单中捕获的数据。该脚本可以正常工作并且可以毫无问题地完成它应该做的事情。但是,当我使用新帐户登录时,开始菜单中缺少 IE 磁贴。该脚本在“%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs”处创建了缺少的快捷方式,正如我在其他几页上所读到的那样。但是这个修复似乎对我不起作用。
此脚本还删除了 windows 10 新用户欢迎视频。
这是脚本:
$key = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
$filecontent = @"
<LayoutModificationTemplate Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6" xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout">
<start:Group Name="General Apps" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="1x1" Column="2" Row="1" AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />
<start:Tile Size="1x1" Column="3" Row="1" AppUserModelID="Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI" />
<start:DesktopApplicationTile Size="1x1" Column="2" Row="0" DesktopApplicationID="Microsoft.SoftwareCenter.DesktopToasts" />
<start:Tile Size="1x1" Column="4" Row="1" AppUserModelID="Microsoft.WindowsStore_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="1x1" Column="4" Row="0" DesktopApplicationID="{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\SnippingTool.exe" />
<start:Tile Size="1x1" Column="5" Row="0" AppUserModelID="Microsoft.People_8wekyb3d8bbwe!x4c7a3b7dy2188y46d4ya362y19ac5a5805e5x" />
<start:Tile Size="1x1" Column="3" Row="0" AppUserModelID="Microsoft.WindowsCalculator_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="1x1" Column="0" Row="0" DesktopApplicationID="Microsoft.InternetExplorer.Default" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="2x2" Column="0" Row="0" AppUserModelID="Microsoft.BingWeather_8wekyb3d8bbwe!App" />
<start:Tile Size="2x2" Column="2" Row="0" AppUserModelID="Microsoft.BingNews_8wekyb3d8bbwe!AppexNews" />
</start:Group>
<start:Group Name="Remote Tools" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Windows.RemoteDesktop" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="Juniper.Junos Pulse.UserInterface" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Office.OUTLOOK.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="Microsoft.Office.WINWORD.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationID="Microsoft.Office.EXCEL.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationID="Microsoft.Office.lync.exe.15" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="2" DesktopApplicationID="Microsoft.Office.ONENOTE.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="2" DesktopApplicationID="Microsoft.Office.POWERPNT.EXE.15" />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
"@
<# Remove Weclome Video #>
$res = Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -ErrorAction SilentlyContinue
if (-not $res)
{New-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -value "0" -PropertyType "DWord"}
else
{Set-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -value "0"}
<# Load XML Data #>
New-Item $env:ProgramData\testing\menulayout -ItemType directory
echo $filecontent |out-file $env:ProgramData\lmco\menulayout\LayoutModification.xml
Import-StartLayout -LayoutPath $env:ProgramData\lmco\menulayout\LayoutModification.xml -MountPath $env:SystemDrive\
<# Add IE Shorcut #>
$TargetFile = "C:\Program Files\Internet Explorer\iexplore.exe"
$ShortcutFile = "$env:ALLUSERSPROFILE\Microsoft\Windows\Start Menu\Programs\Internet Explorer 11.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
$Shortcut.TargetPath = $TargetFile
$Shortcut.Save()
<# Cleanup #>
Remove-Item $env:ProgramData\testing\menulayout -Recurse -Force
只是想知道是否有人可以对此进行测试,看看他们是否会得到相同的结果。或者即使有人找到了如何显示丢失的瓷砖。
如果我使用 <start:DesktopApplicationTile Size="1x1" Column="0" Row="0" DesktopApplicationID="%appdata%\Microsoft\Windows\Start Menu\Programs\Internet Explorer.lnk" />
之类的东西将磁贴设置为硬链接快捷方式,我最终会完全破坏用户的开始菜单。
我还发现,当我仅对 IE 行进行更改时,Store Tile 偶尔会从一开始就消失,所以我得到了一些奇怪的结果。
此外,当我 运行 对刚登录的用户执行 export-startlayout 时,我可以看到开始菜单 xml 没有丢失图块的记录。
而且我也尝试过使用实际的 XML 文件导入,我得到了相同的结果 运行 手工输入 2 行。
这是脚本的最终版本。遗憾的是最终没有使用它,但很高兴让它工作。
<# Detect Office Version #>
$office2013 = (Get-ItemProperty "HKLM:\Software\Microsoft\Office.0\Outlook" -ErrorAction SilentlyContinue)
$office2016 = (Get-ItemProperty "HKLM:\Software\Microsoft\Office.0\Outlook" -ErrorAction SilentlyContinue)
if($office2013) {$officeversion = "2013"}
if($office2016) {$officeversion = "2016"}
<# Reg Values #>
$key = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
<# XML Data 2016 #>
if ($officeversion -eq 2016) {
$filecontent = @"
<LayoutModificationTemplate Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6" xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout">
<start:Group Name="General Apps" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="1x1" Column="2" Row="1" AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />
<start:Tile Size="1x1" Column="3" Row="1" AppUserModelID="Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI" />
<start:DesktopApplicationTile Size="1x1" Column="2" Row="0" DesktopApplicationID="Microsoft.SoftwareCenter.DesktopToasts" />
<start:Tile Size="1x1" Column="4" Row="1" AppUserModelID="Microsoft.WindowsStore_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="1x1" Column="4" Row="0" DesktopApplicationID="{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\SnippingTool.exe" />
<start:Tile Size="1x1" Column="5" Row="0" AppUserModelID="Microsoft.People_8wekyb3d8bbwe!x4c7a3b7dy2188y46d4ya362y19ac5a5805e5x" />
<start:Tile Size="1x1" Column="3" Row="0" AppUserModelID="Microsoft.WindowsCalculator_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="{6D809377-6AF0-444B-8957-A3773F02200E}\Internet Explorer\iexplore.exe" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="2x2" Column="0" Row="0" AppUserModelID="Microsoft.BingWeather_8wekyb3d8bbwe!App" />
<start:Tile Size="2x2" Column="2" Row="0" AppUserModelID="Microsoft.BingNews_8wekyb3d8bbwe!AppexNews" />
</start:Group>
<start:Group Name="Remote Tools" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Windows.RemoteDesktop" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="Juniper.Junos Pulse.UserInterface" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Office.OUTLOOK.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="Microsoft.Office.WINWORD.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationID="Microsoft.Office.EXCEL.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationID="Microsoft.Office.lync.exe.15" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="2" DesktopApplicationID="Microsoft.Office.ONENOTE.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="2" DesktopApplicationID="Microsoft.Office.POWERPNT.EXE.15" />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
"@
}
<# XML Data 2013 #>
if ($officeversion -eq 2013) {
$filecontent = @"
<LayoutModificationTemplate Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6" xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout">
<start:Group Name="General Apps" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="1x1" Column="2" Row="1" AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />
<start:Tile Size="1x1" Column="3" Row="1" AppUserModelID="Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI" />
<start:DesktopApplicationTile Size="1x1" Column="2" Row="0" DesktopApplicationID="Microsoft.SoftwareCenter.DesktopToasts" />
<start:Tile Size="1x1" Column="4" Row="1" AppUserModelID="Microsoft.WindowsStore_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="1x1" Column="4" Row="0" DesktopApplicationID="{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\SnippingTool.exe" />
<start:Tile Size="1x1" Column="5" Row="0" AppUserModelID="Microsoft.People_8wekyb3d8bbwe!x4c7a3b7dy2188y46d4ya362y19ac5a5805e5x" />
<start:Tile Size="1x1" Column="3" Row="0" AppUserModelID="Microsoft.WindowsCalculator_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="{6D809377-6AF0-444B-8957-A3773F02200E}\Internet Explorer\iexplore.exe" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:Tile Size="2x2" Column="0" Row="0" AppUserModelID="Microsoft.BingWeather_8wekyb3d8bbwe!App" />
<start:Tile Size="2x2" Column="2" Row="0" AppUserModelID="Microsoft.BingNews_8wekyb3d8bbwe!AppexNews" />
</start:Group>
<start:Group Name="Remote Tools" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Windows.RemoteDesktop" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="Juniper.Junos Pulse.UserInterface" />
</start:Group>
<start:Group Name="" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationID="Microsoft.Office.OUTLOOK.EXE.15" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationID="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Microsoft Office\Office15\WINWORD.EXE" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationID="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Microsoft Office\Office15\EXCEL.EXE" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationID="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Microsoft Office\Office15\lync.exe" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="2" DesktopApplicationID="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Microsoft Office\Office15\POWERPNT.EXE" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="2" DesktopApplicationID="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Microsoft Office\Office15\ONENOTE.EXE" />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
"@
}
<# Remove Weclome Video #>
$res = Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -ErrorAction SilentlyContinue
if (-not $res)
{New-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -value "0" -PropertyType "DWord"}
else
{Set-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE$key -name EnableFirstLogonAnimation -value "0"}
<# Load XML Data #>
$folderexist = (test-path $env:ProgramData\lmco\)
if ($folderexist)
{New-Item $env:ProgramData\lmco\menulayout -ItemType directory}
else
{New-Item $env:ProgramData\LMCO\ -ItemType directory; New-Item $env:ProgramData\lmco\menulayout -ItemType directory}
echo $filecontent |out-file $env:ProgramData\lmco\menulayout\LayoutModification.xml
Import-StartLayout -LayoutPath $env:ProgramData\lmco\menulayout\LayoutModification.xml -MountPath $env:SystemDrive\
<# Add IE Shorcut #>
$TargetFile = "C:\Program Files\Internet Explorer\iexplore.exe"
$ShortcutFile = "$env:ALLUSERSPROFILE\Microsoft\Windows\Start Menu\Programs\Internet Explorer.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
$Shortcut.TargetPath = $TargetFile
$Shortcut.Save()
<# Cleanup #>
Remove-Item $env:ProgramData\lmco\menulayout -Recurse -Force
我自己在应用程序中遇到了一些 IE 问题。据我所知,Microsoft.InternetExplorer.Default 似乎不起作用,虽然一些指南说 Microsoft.Explorer.Default 对 IE 有效,但这可以追溯到一篇原始 technet 文章中的拼写错误。我使用捕获的非通用 AppID 使其工作
{6D809377-6AF0-444B-8957-A3773F02200E}\Internet Explorer\iexplore.exe
64 位和
{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Internet Explorer\iexplore.exe
32 位。您可以使用 Powershell 命令 'Get-StartApps' 为所有可能的程序获取此 ID,因此:
Get-StartApps | where {$_.Name -ilike 'Internet Explorer*'}
如果 IE 坏了,只获取它。如您所见,here 这些是 ProgramFilesx64 和 x86 文件夹的 GUID。还有一个用于 ProgramFiles 的通用文件 ({905E63B6-C1BF-494E-B29C-65B732D3D21A}),但由于它未与 Get-StartApps 一起列出,因此可能无法使用。
然而,首先这个解决方案不适用于 x64 和 x86 windows 一个文件,其次对我来说似乎它可能会在某个时候中断。这不太可能,因为存在 ID,因为 vista 和更改 GUID 会破坏很多兼容性,但我仍然宁愿不依赖更晦涩的方法,只要有替代方法。
因此我选择了使用 lnk 文件的解决方案。如果你这样做了,你就不能再使用 DesktopApplicationID
,而是 DesktopApplicationLinkPath
。正确的语法应该是:
<start:DesktopApplicationTile Size="1x1" Column="0" Row="0" DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\Internet Explorer.lnk" />