GVKun编程网logo

如何从 PowerShell 命令行查找 Windows 版本(powershell查看版本命令)

5

如果您想了解如何从PowerShell命令行查找Windows版本和powershell查看版本命令的知识,那么本篇文章将是您的不二之选。我们将深入剖析如何从PowerShell命令行查找Window

如果您想了解如何从 PowerShell 命令行查找 Windows 版本powershell查看版本命令的知识,那么本篇文章将是您的不二之选。我们将深入剖析如何从 PowerShell 命令行查找 Windows 版本的各个方面,并为您解答powershell查看版本命令的疑在这篇文章中,我们将为您介绍如何从 PowerShell 命令行查找 Windows 版本的相关知识,同时也会详细的解释powershell查看版本命令的运用方法,并给出实际的案例分析,希望能帮助到您!

本文目录一览:

如何从 PowerShell 命令行查找 Windows 版本(powershell查看版本命令)

如何从 PowerShell 命令行查找 Windows 版本(powershell查看版本命令)

如何找到我正在使用的 Windows 版本?

我正在使用 PowerShell 2.0 并尝试过:

PS C:\> verThe term ''ver'' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.At line:1 char:4+ ver <<<<     + CategoryInfo          : ObjectNotFound: (ver:String) [], CommandNotFoundException    + FullyQualifiedErrorId : CommandNotFoundException

我该怎么做呢?

答案1

小编典典

由于您可以访问 .NET 库,因此您可以访问该类的OSVersion属性System.Environment来获取此信息。对于版本号,有Version属性。

例如,

PS C:\> [System.Environment]::OSVersion.VersionMajor  Minor  Build  Revision-----  -----  -----  --------6      1      7601   65536

可以在此处找到 Windows 版本的详细信息。

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期望命令等效

powershell – Windows期望命令等效

什么相当于 Linux在Windows中的期望?当前一个命令提示时,脚本是否有办法发送密码?

runas /user:admin net user username /add

尝试回声XYZ | runas …我得到了1326登录失败:未知的用户名或密码错误.该命令在没有管道回声的情况下工作.

解决方法

PowerShell中没有内置任何功能.但是有一个模块应该能够做到这一点,称为Await – https://msconfiggallery.cloudapp.net/packages/Await/

有关如何使用Await的PowerShell Summit会议 – https://www.youtube.com/watch?v=tKyAVm7bXcQ

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功能的更改.

powershell – 标准Windows用户如何从命令行更改其密码?

powershell – 标准Windows用户如何从命令行更改其密码?

在 Windows Server 2008 R2上,我有一个标准(非管理员)本地用户(不是Active Directory帐户,但服务器位于域中),只能通过PowerShell远程处理访问服务器.用户无法通过RDP登录.

我希望这个用户能够更改他们的密码. “net user”命令需要管理员权限,即使用户尝试更改自己的密码也是如此.

标准用户如何从命令行更改密码?

以下是一些PowerShell代码,可以使用域帐户执行您正在寻找的内容:
param (
    [string]$oldPassword = $( Read-Host "Old password"),[string]$newPassword = $( Read-Host "New password")
)

$ADSystemInfo = New-Object -ComObject ADSystemInfo
$type = $ADSystemInfo.GetType()
$user = [ADSI] "LDAP://$($type.InvokeMember('UserName','GetProperty',$null,$ADSystemInfo,$null))"
$user.ChangePassword( $oldPassword,$newPassword)

ASDI提供程序还支持ChangePassword()方法的语法WinNT:// computername / username.但是,ADSystemInfo对象不适用于机器本地帐户,因此只使用WinNT:// …语法改进上述代码是不可行的.

(任何人都想建议编辑w /代码来区分本地和域帐户?)

在完全不同的方面,旧的NetUserChangePassword API也适用于本地(和域,如果您在NetBIOS语法中指定域名)帐户:

param (
    [string]$oldPassword = $( Read-Host "Old password"),[string]$newPassword = $( Read-Host "New password")
)

$MethodDeFinition = @'
[DllImport("netapi32.dll",CharSet = CharSet.Unicode)]
public static extern bool NetUserChangePassword(string domainname,string username,string oldPassword,string newPassword);
'@

$NetAPI32 = Add-Type -MemberDeFinition $MethodDeFinition -Name 'NetAPI32' -Namespace 'Win32' -Passthru

$NetAPI32::NetUserChangePassword('.',$env:username,$oldPassword,$newPassword)

此代码假定您正在更改本地计算机上的密码(“.”).

关于如何从 PowerShell 命令行查找 Windows 版本powershell查看版本命令的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于Microsoft.SharePoint.PowerShellpipe理单元:不正确的Windows PowerShell版本3.0 当前控制台支持Window PowerShell 2.0版、powershell – Windows期望命令等效、powershell – 如何在Windows 10中从命令行打开/关闭Windows功能?、powershell – 标准Windows用户如何从命令行更改其密码?等相关知识的信息别忘了在本站进行查找喔。

本文标签: