GVKun编程网logo

在Windows 8 RTM中的.NET应用程序中嵌入Powershell v2.0

12

如果您对在Windows8RTM中的.NET应用程序中嵌入Powershellv2.0感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于在Windows8RTM中的.NET应用

如果您对在Windows 8 RTM中的.NET应用程序中嵌入Powershell v2.0感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于在Windows 8 RTM中的.NET应用程序中嵌入Powershell v2.0的详细内容,并且为您提供关于.NET应用程序在Windows 10上将不同的操作系统版本返回给PowerShell、Microsoft.SharePoint.PowerShellpipe理单元:不正确的Windows PowerShell版本3.0 当前控制台支持Window PowerShell 2.0版、powershell – 如何在Windows 10中从命令行打开/关闭Windows功能?、powershell怎么打开文件?windows powershell教程的有价值信息。

本文目录一览:

在Windows 8 RTM中的.NET应用程序中嵌入Powershell v2.0

在Windows 8 RTM中的.NET应用程序中嵌入Powershell v2.0

在从Windows 7升级之前尝试运行托管的PowerShell脚本时,我收到以下错误我从来没有收到此错误。

The following error occurred while loading the extended type data
file: Microsoft.PowerShell.Core,
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2977) : Error
in type “System.Security.AccessControl.ObjectSecurity”: Exception: The
getter method should be public,non void,static,and have one
parameter of type PSObject. Microsoft.PowerShell.Core,
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2984) : Error
in type “System.Security.AccessControl.ObjectSecurity”: Exception: The
getter method should be public,
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2991) : Error
in type “System.Security.AccessControl.ObjectSecurity”: Exception: The
getter method should be public,
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2998) : Error
in type “System.Security.AccessControl.ObjectSecurity”: Exception: The
getter method should be public,
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3005) : Error
in type “System.Security.AccessControl.ObjectSecurity”: Exception: The
getter method should be public,and have one
parameter of type PSObject.

我已经在App.config中应用了以下内容

<dependentAssembly>
              <assemblyIdentity name="System.Management.Automation" publicKeyToken="31bf3856ad364e35" />
              <publisherPolicy apply="no" />
            </dependentAssembly>

可能是什么问题?

解决方案是执行以下操作,而不是仅添加一个仅适用于System.Management.Automation的块,如我阅读的帖子所建议的,您需要为所有引用的PS程序集添加一个块。
<runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Management.Automation" publicKeyToken="31bf3856ad364e35" />
            <publisherPolicy apply="no" />
          </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.PowerShell.Commands.Utility" publicKeyToken="31bf3856ad364e35" />
          <publisherPolicy apply="no" />
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.PowerShell.ConsoleHost" publicKeyToken="31bf3856ad364e35" />
          <publisherPolicy apply="no" />
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.PowerShell.Commands.Management" publicKeyToken="31bf3856ad364e35" />
          <publisherPolicy apply="no" />
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.PowerShell.Security" publicKeyToken="31bf3856ad364e35" />
          <publisherPolicy apply="no" />
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.PowerShell.Commands.Diagnostics" publicKeyToken="31bf3856ad364e35" />
          <publisherPolicy apply="no" />
        </dependentAssembly>
        </assemblyBinding>
    </runtime>

.NET应用程序在Windows 10上将不同的操作系统版本返回给PowerShell

.NET应用程序在Windows 10上将不同的操作系统版本返回给PowerShell

我正在尝试确定.NET应用程序中的操作系统版本,该应用程序已经使用System.Environment.Osversion成功确定所有版本的Windows(最高为Windows 8.1)的版本。

但是,在Windows 10上的.NET应用程序中调用System.Environment.Osversion时,返回的版本是Microsoft Windows NT 6.2.9200.0 (与Windows 8.1上的输出完全相同)。 但是,当通过PowerShell调用[System.Environment]::Osversion Microsoft Windows NT 10.0.10240.0 ,输出会给我Microsoft Windows NT 10.0.10240.0 。

我的印象是,PowerShell在.NET下使用.NET,期望这两个调用返回完全相同的输出。 为什么在输出中有差异,更重要的是,如何检测我的应用程序是否在Windows 10上运行?

如何使用Windows SDK更新“其他时钟”设置

在windows phone 8.1 C#中显示&#8211带笑脸的文字(笑脸看起来像&#8211。)

机器在.NET中的域名?

.NET在Linux上,〜/文件夹是错误的?

Windows,.NET阅读鼠标光标下的文本

静态string使用File.ReadAllText

以编程方式将规则添加到AVG防火墙

将安装Visual Studio 2010 +奥斯陆CTP螺丝我的Visual Studio 08安装?

我解密的密码是1个字符或短

在Linux中运行.NET EXE

我认为这是原因 :

随着Windows 8.1的发布, GetVersion API的行为在操作系统版本的返回值中发生了变化。 GetVersion函数返回的值现在取决于应用程序的表现方式。

不适用于Windows 8.1或Windows 10的应用程序将返回Windows 8操作系统版本值(6.2)。

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中从命令行打开/关闭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教程

powershell怎么打开文件?windows powershell教程

powershell怎么打开文件?powershell可通过命令或脚本来管理计算机,从而通过系统自动化来提高工作效率,那怎么利用powershell打开想要操作的文件呢?

powershell怎么打开文件?

1、按下WIN+R组合键,在打开的搜索框中输入POWERSHELL。

2、接着进入你要打开文件的目录,可以用 cd 盘符:路径 这串命令来进入要打开文件的目录。然后输入 dir 命令来查看当前目录所有文件。例如小编要打开名为“截图”的PNG图片文件。

3、在输入命令时,一定要留意文件的拓展名,输入时不要忘记加上去。命令:。/文件名。拓展名。

4、注意事项:不要使用chcp 937来切换为英文代码页,否则中文会显示不出。

今天关于在Windows 8 RTM中的.NET应用程序中嵌入Powershell v2.0的讲解已经结束,谢谢您的阅读,如果想了解更多关于.NET应用程序在Windows 10上将不同的操作系统版本返回给PowerShell、Microsoft.SharePoint.PowerShellpipe理单元:不正确的Windows PowerShell版本3.0 当前控制台支持Window PowerShell 2.0版、powershell – 如何在Windows 10中从命令行打开/关闭Windows功能?、powershell怎么打开文件?windows powershell教程的相关知识,请在本站搜索。

本文标签: