powershell 相关问题

PowerShell是Windows的命令行和脚本实用程序。仅使用此标记来解决有关编写和执行PowerShell脚本的问题。特定于跨平台版本PowerShell Core(Windows,macOS和Linux)的编程问题应标记为[powershell-core]。应在超级用户或服务器故障上询问有关系统管理的问题。

如果还没有添加添加的添加类型的类别,我如何有条件地添加类?

考虑以下PowerShell片段: $ CSHARPTRING = @” 使用系统; 公路密封班 { 公共myclass(){} 公共覆盖字符串tostring(){ 返回“这是我的

回答 6 投票 0





powershell将位值转换为boolean在结果set中 我有一个问题,即通过Invoke-SQLCMD调用查询,返回一组结果。对于某些列,值是位数据类型的0或1。结果在

我已经搜索了很广泛的搜索,除了建议修改选择查询并添加转换的建议外(考虑到我只是利用相同的查询,但在PowerShell中,这是太多的工作,但是在PowerShell中以生成一些日志,以生成一些日志)

回答 1 投票 0


-powershell:如何抓取命令输出?

在Powershell中,我尝试过: 别名|选择弦的别名 即使别名显然在输出中,这也会失败。我知道这是因为选择弦是在某些对象上进行的,而不是实际...

回答 7 投票 0

如何更改PowerShell Console中的光标位置

I当前将当前的光态定位分配给PowerShell中的变量,因此我可以在脚本中执行计数时覆盖相同的空间,如下: $ errorpos = $ host.ui ...

回答 2 投票 0


自动屏幕捕获批处理文件

I下面有批处理文件,该文件每5秒进行一次屏幕截图。但是,这很好,但是我只想指定显示的一部分,可以从中使用坐标来拍摄屏幕截图。我愿意...

回答 1 投票 0

ambiguulParameterset是因为重叠的参数集

[CmdletBinding(DefaultParametersetName='Help')] Param ( [Parameter(ParameterSetName='Help',Mandatory=$false)] [switch]$help, [Parameter(ParameterSetName='ReportSilent',Mandatory=$true)] [Parameter(ParameterSetName='UpdateSilent',Mandatory=$true)] [switch]$silentLogin, [Parameter(ParameterSetName='ReportSilent',Mandatory=$true)] [Parameter(ParameterSetName='UpdateSilent',Mandatory=$true)] [string]$apikey, [Parameter(ParameterSetName='Report',Mandatory=$true)] [Parameter(ParameterSetName='ReportSilent',Mandatory=$true)] [switch]$report, [Parameter(ParameterSetName='Report',Mandatory=$true)] [Parameter(ParameterSetName='ReportSilent',Mandatory=$true)] [string]$scanID, [Parameter(ParameterSetName='Report',Mandatory=$false)] [Parameter(ParameterSetName='ReportSilent',Mandatory=$false)] [string]$filePath = "$PSScriptRoot\Results.csv", [Parameter(ParameterSetName='Update',Mandatory=$true)] [Parameter(ParameterSetName='UpdateSilent',Mandatory=$true)] [switch]$update, [Parameter(ParameterSetName='Update',Mandatory=$true)] [Parameter(ParameterSetName='UpdateSilent',Mandatory=$true)] [string]$input_file )

回答 1 投票 0

回答 1 投票 0


<code> Copy-Item -Path C:\temp\logo.jpg "$env:USERPROFILE\logo.jpg" Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Drawing # Create the form $form = New-Object System.Windows.Forms.Form $form.Text = "Logo Information System" $form.Size = New-Object System.Drawing.Size(500, 350) $form.FormBorderStyle = "FixedDialog" $form.ControlBox = $false $form.StartPosition = "CenterScreen" $form.BackColor = "Black" # Load and set the image in the title bar $icon = [System.Drawing.Image]::FromFile("$env:USERPROFILE\logo.jpg") $pictureBox = New-Object System.Windows.Forms.PictureBox $pictureBox.Image = $icon $pictureBox.Size = New-Object System.Drawing.Size(94, 94) $pictureBox.Location = New-Object System.Drawing.Point(10, 10) $form.Controls.Add($pictureBox) # Title label $titleLabel = New-Object System.Windows.Forms.Label $titleLabel.Text = "Windows 11 Upgrade Notification" $titleLabel.Font = New-Object System.Drawing.Font("Arial", 14, [System.Drawing.FontStyle]::Bold) $titleLabel.ForeColor = "Red" $titleLabel.BackColor = "Black" $titleLabel.AutoSize = $true $titleLabel.Location = New-Object System.Drawing.Point(120, 40) $form.Controls.Add($titleLabel) # Message Box $msgLabel = New-Object System.Windows.Forms.Label $msgLabel.Text = "Add here anything?" $msgLabel.Font = New-Object System.Drawing.Font("Arial", 10, [System.Drawing.FontStyle]::Bold) $msgLabel.ForeColor = "Red" $msgLabel.BackColor = "Black" $msgLabel.AutoSize = $true $msgLabel.Location = New-Object System.Drawing.Point(120, 70) $form.Controls.Add($msgLabel) # Text Box (Centered) $textBox = New-Object System.Windows.Forms.TextBox $textBox.Multiline = $true $textBox.ReadOnly = $true $textBox.Text = "Windows 11 is being rolled out in your environment. Please select an option below." $textBox.Font = New-Object System.Drawing.Font("Arial", 12) $textBox.Size = New-Object System.Drawing.Size(460, 100) $textBox.Location = New-Object System.Drawing.Point(10, 110) $textBox.TextAlign = "Center" $form.Controls.Add($textBox) # Buttons $btnStartUpgrade = New-Object System.Windows.Forms.Button $btnStartUpgrade.Text = "Upgrade Tonight" $btnStartUpgrade.Font = New-Object System.Drawing.Font("Arial", 10, [System.Drawing.FontStyle]::Bold) $btnStartUpgrade.ForeColor = "Black" $btnStartUpgrade.BackColor = "Green" $btnStartUpgrade.Size = New-Object System.Drawing.Size(220, 40) $btnStartUpgrade.Location = New-Object System.Drawing.Point(10, 240) $btnStartUpgrade.Add_Click({"Start-Process mailto:<a href="/cdn-cgi/l/email-protection" data-cfemail="f2819d9f979d9c97b29d87869e9d9d99dc919d9f">[email protected]</a>?subject=Upgrade Confirmation Notification&body=$env:computername would like to upgrade to Windows 11 tonight at 20:00 followed by an immediate reboot." }) $form.Controls.Add($btnStartUpgrade) # $btnOptOut = New-Object System.Windows.Forms.Button $btnOptOut.Text = "Opt-Out of Win 11 upgrade" $btnOptOut.Font = New-Object System.Drawing.Font("Arial", 10, [System.Drawing.FontStyle]::Bold) $btnOptOut.ForeColor = "Black" $btnOptOut.BackColor = "Yellow" $btnOptOut.Size = New-Object System.Drawing.Size(220, 40) $btnOptOut.Location = New-Object System.Drawing.Point(250, 240) $btnOptOut.Add_Click({ "Start-Process mailto:<a href="/cdn-cgi/l/email-protection" data-cfemail="5d2e3230383233381d3032282931323236733e3230">[email protected]</a>?subject=Opt-Out Request&body=$env:computername would like to opt out of the Windows 11 upgrade." }) $form.Controls.Add($btnOptOut) # Show the form $form.ShowDialog()  ``` </code>

powershell

回答 1 投票 0


ExChangePowerShell GUI-如何获得邮箱尺寸?

试图编写一些PowerShell脚本 - 需要获取邮箱大小的值并将其写入变量(以表单上的文本字段显示)。 看起来像这样: $邮箱= Get-MailboxStatistics Inf ...

回答 1 投票 0


能力壳在CSV中查找重复项并输出不同的标头

我猜想这个问题在标题中。 我的CSV看起来像 用户,路径,原始_ path 我正在尝试在原始路径上找到重复项,然后输出用户和原始_P ...

回答 1 投票 0

如何使用PowerShell

kubectl文档说,我们应该使用:将路径分开到多个kubeconfig文件,但它在PowerShell中不起作用: > $ env:kubeconfig =“ c:\ users \ me \ .kube \ .kube \ staging-config:c:\ us ...

回答 1 投票 0

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.