GVKun编程网logo

用于删除 Windows 更新的 Powershell 脚本 (APC_Index_BSOD)(powershell卸载更新)

66

在本文中,我们将为您详细介绍用于删除Windows更新的Powershell脚本(APC_Index_BSOD)的相关知识,并且为您解答关于powershell卸载更新的疑问,此外,我们还会提供一些关

在本文中,我们将为您详细介绍用于删除 Windows 更新的 Powershell 脚本 (APC_Index_BSOD)的相关知识,并且为您解答关于powershell卸载更新的疑问,此外,我们还会提供一些关于Microsoft.SharePoint.PowerShellpipe理单元:不正确的Windows PowerShell版本3.0 当前控制台支持Window PowerShell 2.0版、PowerShell – Windows 10上缺少Install-WindowsFeature(和系列)?、powershell – Windows删除文件夹’.’、powershell – 如何在Windows 10中从命令行打开/关闭Windows功能?的有用信息。

本文目录一览:

用于删除 Windows 更新的 Powershell 脚本 (APC_Index_BSOD)(powershell卸载更新)

用于删除 Windows 更新的 Powershell 脚本 (APC_Index_BSOD)(powershell卸载更新)

我会通过删除工作内容来简化脚本。除非您确实需要在后台运行,否则只会使事情复杂化。即使需要后台操作,在并行化之前先创建一个工作线性脚本也会很有帮助。

# Updates to find
$searchUpdates = 'KB5000802','KB5000808','KB5000822','KB5000809'

Write-Host "Checking whether the following updates are installed: $($searchUpdates -join ',')"

# Checks which updates are installed

$allUpdates = wmic qfe list brief /format:table

$foundUpdates = $searchUpdates | Where-Object { 
    $allUpdates | Select-String -Pattern $_ -CaseSensitive -SimpleMatch }

if( $foundUpdates ) {
    Write-Host "Found the following installed updates: $($foundUpdates -join ',')"

    # Uninstall the found updates

    foreach( $update in $foundUpdates ) {
        Write-Host "Uninstalling found update of: $update"
        wusa /uninstall /kb:$update /promptrestart

        # TODO: check $LASTEXITCODE to determine whether removal was successful
    }

    Write-Host 'Stopping windows update...'

    net stop wuauserv
    net pause wuauserv
    net stop bits
    net pause bits
    net stop dosvc
    net pause dosvc
}
else {
    Write-Host 'None of these updates are installed.'
}

进一步的变化:

  • 删除了数组子表达式运算符 @(),因为逗号分隔的列表已经定义了一个数组
  • 只查询一次 wmic 以提高性能
  • 将第一个 foreach 替换为 Where-Object 语句。
  • 为了清晰起见重命名了一些变量
  • 添加了更多日志,以便您可以验证中间结果
  • echo 替换为 Write-Host,这让未来的访问者可以更轻松地查找文档

Microsoft.SharePoint.PowerShellpipe理单元:不正确的Windows PowerShell版本3.0 当前控制台支持Window PowerShell 2.0版

Microsoft.SharePoint.PowerShellpipe理单元:不正确的Windows PowerShell版本3.0 当前控制台支持Window PowerShell 2.0版

我在我的机器上安装了SharePoint 2010,用于开发目的,而且我错误地升级到.Net 4.0和PowerShell 3.0。

解决这个问题,使用-version 2.0或-v 2 switch / arguement运行powershell并不完全正常。

所以,这个问题是如何在PowerShell中添加Microsoft.Sharepoint.PowerShellpipe理单元,在具有.Net 4.0框架的机器上?

尝试1:

Windows中的IP发现

在Windows中检测文件“copY”操作

HRESULT:0x80040154(REGDB_E_CLASSNOTREG))

对于Windows窗体,PostMessage等于自己的什么?

从C#中selectsql Server数据库中的特定logging

PS> Add-PSSnapin Microsoft.Sharepoint.Powershell The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered. PS> Get-SPSite('http://myServerName/') Get-SPSite : Microsoft SharePoint is not supported with version 4.0.30319.18052 of the Microsoft .Net Runtime.

好的,所以我尝试2:

PS> powershell.exe -version 2.0 PS> Add-PSSnapin Microsoft.Sharepoint.Powershell Add-PSSnapin : Incorrect Windows PowerShell version 3.0. Windows PowerShell version 2.0 is supported in the current console. At line:1 char:13 + Add-PSSnapin <<<< Microsoft.Sharepoint.PowerShell + CategoryInfo : InvalidArgument: (Microsoft.Sharepoint.PowerShell:String) [Add-PSSnapin],PSArgumentException + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

我也尝试设置快捷方式的目标。 并卸载以q结尾的Windows更新

所以,这是我的错误,我无法find任何信息: 不正确的Windows PowerShell版本3.0。 当前控制台支持Windows PowerShell版本2.0。

有什么想法吗?

在哪里写日志的Windows应用程序

如何测量C#中的系统空闲时间,不包括看电影等?

如何在Windows窗体上显示必填字段

.NET EXE和DLL之间的堆栈/堆区别

采用Windows媒体基础的H.264编码

如果我打电话,它似乎为我工作

powershell.exe -version 2.0

从命令提示符而不是从Powershell调用它。

最近SharePoint 2010更新后,我可以添加PowerShell管理单元,而在版本2.0中运行PowerShell

PowerShell – Windows 10上缺少Install-WindowsFeature(和系列)?

PowerShell – Windows 10上缺少Install-WindowsFeature(和系列)?

我们有一些Power shell脚本用于设置各种dev / test / prod环境,其中一个安装和配置IIS.遗憾的是,由于缺少Install- WindowsFeature cmdlet,这些脚本目前似乎无法在Windows 10下运行.

有意删除这些,或者是否有一些箍我需要跳过来安装以前不需要的?

虽然Ryan的答案是正确的,但如果您想在工作站上运行脚本,我建议远离Install-WindowsFeature cmdlet.即使您不需要RSAT,也始终依赖于RSAT.

只需使用适用于服务器和工作站的Enable-WindowsOptionalFeature即可.您需要更改脚本,功能名称也不同.

我写了一下:Different ways for installing Windows features on the command line

powershell – Windows删除文件夹’.’

powershell – Windows删除文件夹’.’

我正在使用urbancode Deploy进行 Windows代码部署,在我的文件夹中我创建了一个文件夹’.’ .我已经尝试了所有powershell remove-item命令和我能想到的标志,我已经尝试了robocopy移动/清除将其复制到其他地方,并运行没有报告错误的chkdsk.

当我手动删除它时,我得到’错误0x80070091:目录不为空’.

当我尝试通过powershell删除它时,我得到’Get-ChildItem:路径不是合法的形式’

如果我打开’.’文件夹,好像我做了’ls -l ./’.如果我更深入一点,我会收到错误“此文件路径指的是一个不可用的位置.”

有任何想法如何删除此文件夹?

结束了在这里寻找解决方案,https://superuser.com/questions/78434/how-to-delete-directories-with-path-names-too-long-for-normal-delete

通过在7zip中打开父目录,我可以通过在文件夹上使用shift Delete来删除目录.看起来这可以删除递归创建的文件夹,这些文件夹对于文件资源管理器来说太长了以及非法路径名称.

谢谢@frupfrup,google搜索’windows long path remover’把我带到超级用户链接!还要感谢@Kernal Sterns的其他想法.

powershell – 如何在Windows 10中从命令行打开/关闭Windows功能?

powershell – 如何在Windows 10中从命令行打开/关闭Windows功能?

在 Windows 10和“程序和功能”中,您可以打开或关闭Windows功能,然后启动下载和安装.我希望打开“.Net Framework 3.5”,并将其下载并安装,但我需要通过例如一个Powershell脚本或通过命令.我需要使用命令行.

怎么能实现这一目标?

以管理员身份运行命令提示符并使用:
dism /online /Get-Features

这将显示功能名称,因为它们并不总是与您在该可视功能列表中看到的内容相匹配.它还将显示当前启用/禁用的内容.找到要启用的功能(本例中为NetFx3)后,运行以下命令:

dism /online /Enable-Feature /FeatureName:NetFx3

正如理查德所说,你可以通过简单地将“启用”切换为“禁用”来禁用某项功能.

dism /online /disable-Feature /FeatureName:NetFx3

注意:有时需要重新启动才能查看Windows功能的更改.

关于用于删除 Windows 更新的 Powershell 脚本 (APC_Index_BSOD)powershell卸载更新的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于Microsoft.SharePoint.PowerShellpipe理单元:不正确的Windows PowerShell版本3.0 当前控制台支持Window PowerShell 2.0版、PowerShell – Windows 10上缺少Install-WindowsFeature(和系列)?、powershell – Windows删除文件夹’.’、powershell – 如何在Windows 10中从命令行打开/关闭Windows功能?等相关内容,可以在本站寻找。

本文标签: