以下是一个示例脚本,用于从任务栏中取消固定 Microsoft Edge(新版本): 代码语言:javascript 复制 # Function to unpin an application from the taskbarfunctionUnpin-AppFromTaskbar{param([string]$AppName)$shell=New-Object-ComObject shell.application $folder=$shell.Namespace((Join-Path $env:APPDATA"Micros...
问使用Powershell在Edge中激活Power BI全屏模式EN/* * This assumes you have added MicrosoftWebDri...
1functiongetCPU ([string]$iProcess) {2$z="*$iProcess*"#带'*'用于模糊查找,比如一些列进程名字不同,eg:MicrosoftEdge,MicrosoftEdgeCP3$process1= Get-Process$z45$a=$process1.CPU6sleep$zhouqi7$process2= Get-Process$z8$b=$process2.CPU9$d=$process2.ProcessName10$f=$process2.WS1112$c= ...
(new-object -ComObject hnetcfg.fwpolicy2).rules | where {$_.localports -eq 3389 -and $_.direction -eq 1} | format-table Name,Enabled Get-NetFirewallPortFilter 於2012+ 提供。 針對 2008R2, hnetcfg.fwpolicy2 請使用 COM 物件。 停用Windows 防火牆 Set-NetFirewallProfile -Profile Domain,...
# This script will rotate between the specified applications$AppNames= @("edge","chrome","code")$wait_time=15$global:counter=0# Create a function to switch tabs in the browserfunctionSwitch-BrowserTab($browsername){$browser=New-Object-ComObject wscript.shellif($browser){$b...
$RegKeyName="OSDBuild"$WMIClassName="OSDBuildInfo"# Choose a suitable name for your WMI class# Set values$tsenv=New-Object-COMObject Microsoft.SMS.TSEnvironment$FullRegKeyName="HKLM:\SOFTWARE\"+$regkeyname# ... (Your existing code for getting values remains the same) ...# Write values ...
function Add-FirewallRule { param( $name, $tcpPorts, $appName = $null, $serviceName = $null ) $fw = New-Object -ComObject hnetcfg.fwpolicy2 $rule = New-Object -ComObject HNetCfg.FWRule $rule.Name = $name if ($appName -ne $null) { $rule.ApplicationName = $appName } if ($s...
# 创建Excel 应用程序对象$xl=new-object-comobjectExcel.Application# 显示Excel 软件的主界面窗口$xl.visible =$true# 打开一个Excel文档$wb=$xl.workbooks.open("C:\Scripts\PowerShell\test.xls")# 获取Excel 文档的工作薄$ws1=$wb.worksheets |where{$_.name-eq"sheet1"}#<——- Selects sheet 1$ws...
$xl = new-object -comobject Excel.Application # 显示Excel 软件的主界面窗口 $xl.visible = $true # 打开一个Excel文档 $wb = $xl.workbooks.open("C:\Scripts\PowerShell\test.xls") # 获取Excel 文档的工作薄 $ws1 = $wb.worksheets | where {$_.name -eq "sheet1"} #<——- Selects sheet...
Function Connect-Database($Db, $Tables) { $OpenStatic = 3 $LockOptimistic = 3 $connection = New-Object -ComObject ADODB.Connection $connection.Open("Provider = Microsoft.Jet.OLEDB.4.0;Data Source=$Db" ) Update-Records($Tables) } #End Connect-DataBase En función de la actualización de...