我为Windows 10部署创建了一个基线,它将StartMenu设置为默认布局。 (由于一些内部政治,我不得不把它作为基线,所以不要问:-)。)
此基线创建一个XML文件,其中包含通过Powershell从先前的Startmenu导出中捕获的数据。该脚本可以正常运行并完成它应该做的事情。但是当我使用新帐户登录时,开始菜单缺少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
只是想知道是否有人可以测试一下,看看他们是否得到了相同的结果。或者即使有人找到了如何让Missing Tiles显示出来。
如果我使用类似<start:DesktopApplicationTile Size="1x1" Column="0" Row="0" DesktopApplicationID="%appdata%\Microsoft\Windows\Start Menu\Programs\Internet Explorer.lnk" />
的内容将磁贴设置为硬链接快捷方式,我最终会完全打破用户的起始菜单。
我还发现,当我对IE行进行更改时,Store Tile偶尔会从一开始就消失,所以我得到了一些奇怪的结果。
此外,当我在刚登录的用户上运行export-startlayout时,我可以看到startmenu xml没有丢失磁贴的记录。
我也尝试使用实际的XML文件导入,并且手动运行2行得到相同的结果。
这是脚本的最终版本。结束时不要遗憾地使用它,但让它工作很好。
<# Detect Office Version #>
$office2013 = (Get-ItemProperty "HKLM:\Software\Microsoft\Office\15.0\Outlook" -ErrorAction SilentlyContinue)
$office2016 = (Get-ItemProperty "HKLM:\Software\Microsoft\Office\16.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
答案 0 :(得分:1)
我自己在应用程序中遇到了一些问题。据我所知,Microsoft.InternetExplorer.Default似乎不起作用,虽然一些指南说Microsoft.Explorer.Default适用于IE,这可以追溯到原始technet文章之一的拼写错误。我使用捕获的非通用AppID
来使用它{6D809377-6AF0-444B-8957-A3773F02200E} \ Internet Explorer \ iexplore.exe
for 64Bit和
{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E} \ Internet Explorer \ iexplore.exe
代表32Bit。您可以使用Powershell Command&#39; Get-StartApps&#39;获取此ID。对于所有可能的程序,所以:
Get-StartApps |其中{$ _。姓名-ilike&#39; Internet Explorer *&#39;}
如果它曾经破坏,那么就获得它。如您所见,here这些是ProgramFilesx64和x86文件夹的GUID。 ProgramFiles也有一个通用的({905E63B6-C1BF-494E-B29C-65B732D3D21A})但由于它没有与Get-StartApps一起列出,它可能不起作用。
然而,首先这个解决方案不能在x64和x86窗口中使用一个文件,而在我看来它似乎可能会在某些时候中断。由于vista和更改GUID会破坏很多兼容性,但这并不是很有可能,因为只要有替代方案,我宁愿不依赖于更加模糊的方法。
因此我决定使用lnk文件解决方案。如果您这样做,则不能再使用DesktopApplicationID
,而是使用DesktopApplicationLinkPath
。正确的语法应该是:
<start:DesktopApplicationTile Size="1x1" Column="0" Row="0" DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\Internet Explorer.lnk" />