使用 powershell 更改所有权标签 [英] Changing ownership tag with powershell

查看:60
本文介绍了使用 powershell 更改所有权标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$f =  gwmi -class HPBIOS_BIOSString -Namespace "root\hp\instrumentedbios" | ? {$_.Name -like "*Ownership Tag*"} 
$text = $pcname.text +" Text i want to put after computer name"
$f.getpropertyvalue('ownership tag', "$text")

当我尝试运行上面的代码时,它只会返回错误.$pcname.text 是一个文本框,我在其中放置了本地计算机的名称.错误:找不到GetPropertyValue"和参数计数的重载:2".

When I try to run the code above it only returns errors. $pcname.text is a textbox where i put the name of the local computer. Error: Cannot find an overload for "GetPropertyValue" and the argument count: "2".

有人知道如何使用 powershell 正确更改所有权标签或修复上述代码以使其正常工作.

Does someone know how to properly change the ownership tag with powershell or fix the above code so it works.

推荐答案

您需要使用提升权限来运行此程序:

You will need to run this with elevated rights:

$Text = 'My custom tag'
$BIOSInterface = Get-WmiObject -Namespace root/hp/instrumentedBIOS -Class HP_BIOSSettingInterface
$BIOSInterface.SetBIOSSetting('Ownership Tag', $Text)

如果您的 BIOS 上有密码,则是:

And if there is a password on your BIOS, it is:

$BIOSInterface.SetBIOSSetting('Ownership Tag', $Text, '<utf-16/>Password')

(其中 Password 代表您的纯文本密码)

(Where Password represents your password in plain text)

这篇关于使用 powershell 更改所有权标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆