我在一个域上有 2 个帐户。
我可以用一个帐户登录 citrix 虚拟桌面,但另一个帐户在我第一次更改密码之前不会让我登录任何东西。我是远程的,所以如果不先更改密码,我就无法登录到我有权访问的服务器的 RDP 会话。
是否可以在我知道密码但无法使用该帐户登录任何内容的其他帐户上更改我的密码?
我正在尝试比较包含通配符的字符串。
("www.mysite.*" -match '`*')
Run Code Online (Sandbox Code Playgroud)
但是有些东西不起作用,因为我总是得到真实的回应,例如
("www.mysite.com" -match '`*')
Run Code Online (Sandbox Code Playgroud)
我试过使用 -contains 代替,但我总是错误的。
上周我开发了一个脚本来检查是否在指定的机器上启用了 psremoting。本周我开始编写一个可以在指定机器上启用 psremoting 的脚本,但我无法让 psexec 在 powershell 中运行(另外,是的,我知道可以通过组策略启用 psremoting)。这是我的脚本:
$input = Read-Host @"
Select Option
(1)Manually enter computer(s)
(2)Retrieve computer(s) from file
Option
"@
If ($input -eq 1){
$count = Read-Host "How many computers"
$Computers = 1..$count
$b=0;$c=1; ForEach ($Computer in $Computers) {$Computers[$b] = Read-Host "Computer" $c; $b++; $c++}
} ElseIF ($input-eq 2) {
$Computers = Read-Host "File"
$Computers = Get-Content $Computers
} Else {
write-host "Invalid Option"
Exit
}
cls
$User = Read-Host "Enter username"
$Pass = Read-Host "Enter …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Powershell 来检测某些硬件故障。
Powershell 是否可以连接到正常的 HP 事件/日志/警报以检测驱动器是否出现故障?
我有一个正在开发的 powershell 脚本,它将通过代理从 HTTP 服务器下载文件,并在服务器上包含 UN/PW。
我的文件下载正常,但有些文件非常大,所以我一直在添加一个函数来检查文件是否已更改(检查大小)。这适用于第一个文件。但它在这一行的第二个文件上超时:
$test = $wc2.OpenRead($source) | Out-Null)
Run Code Online (Sandbox Code Playgroud)
下面列出了我的脚本的代码(不包括凭据)。我很感激有关如何正确关闭连接(因为我怀疑没有发生)或如何使用 Powershell 通过 HTTP 获取远程文件大小的建议。
Function getWebClient {
$webClient = new-object System.Net.WebClient
$pxy = new-object System.Net.WebProxy $proxy
$pxy.Credentials = New-Object System.Net.NetworkCredential ("tnad\$proxy_un", "$proxy_pw")
$webClient.proxy=$pxy
$webClient.Headers.Add("user-agent", "Windows Powershell WebClient Header")
$WebClient.Credentials = New-Object System.Net.Networkcredential($un, $pw)
return $WebClient
}
foreach ($ds in $datasetsTest) {
Write-Host "Checking: $ds"
$source = "$server$ds"
$dest = "$destFolder$ds"
#Test whether the destination file already exists, if it exists, compare file sizes.
$destExists = Test-Path $dest …Run Code Online (Sandbox Code Playgroud) 我使用了很多文件夹共享,但是有一些其他进程打开了一堆锁定的文件。
我需要关闭这些文件。到目前为止,我一直在使用 MMC - 系统工具 - 共享文件夹 - 打开文件。
如果我可以使用 PowerShell 过滤由OpenFiles.exe检索到的列表/表,并且一旦我获得文件 ID,使用net file /close或其他一些具有类似效果的 PS 本机方法将其关闭,那将会方便得多。
我是 PowerShell 的新手,所以我想知道是否有办法创建一个 PS 脚本来接收文件的路径,然后使用文件 ID 来关闭该文件?
我需要更改 TCP InitialCongestionWindow 的默认值
我阅读了这个文件:https : //www.iispeed.com/blog/windows-server-2012-and-tcp-slow-start
我在我们的 hyper-v 托管虚拟服务器 2012 R2 上进行了尝试。
PS C:\>Set-NetTCPSetting -SettingName Custom -InitialCongestionWindow 10 -CongestionProvider CTCP
Run Code Online (Sandbox Code Playgroud)
我有错误:
Set-NetTCPSetting : No MSFT_NetTCPSetting objects found with property 'SettingName' equal to 'Custom'. Verify the valu
e of the property and retry.
At line:1 char:1
+ Set-NetTCPSetting -SettingName Custom -InitialCongestionWindow 10 -CongestionPro ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Custom:String) [Set-NetTCPSetting], CimJobException
+ FullyQualifiedErrorId : CmdletizationQuery_NotFound_SettingName,Set-NetTCPSetting
Run Code Online (Sandbox Code Playgroud)
问题是我如何才能完成 IISspeed 文档所讲述的内容?如果我在 Hyper-v 机器上更改此设置,我是否也需要在 hypers-v 主机上更改此设置才能真正发挥作用?
我也应该对 SSL 端口 443 进行相同的更改吗? …
我是 Windows Server 的新手,我很好奇:有没有办法使用 PowerShell 或批处理文件将组安全设置转储到文本文件?谢谢!
我正在尝试执行以下 Powershell 命令:
Enter-PSSession -ComputerName localhost
Run Code Online (Sandbox Code Playgroud)
正在使用的服务器运行的是 Windows Server 2008 R2 SP1 64 位。服务器位于域中。我使用域管理员帐户登录。powershell 会话以管理员身份启动。
我从 powershell 本身收到以下错误消息:
PS C:\Users\Daniel> Enter-PSSession -Computername localhost
Enter-PSSession : Connecting to remote server localhost failed with the following error message : The client cannot
connect to the destination specified in the request. Verify that the service on the destination is running and is
accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most
commonly IIS or WinRM. If …Run Code Online (Sandbox Code Playgroud) 我在 Windows Server 2012 R2 Datacenter 上使用 WSUS 6.3 制作了一个更新服务器。我想使用 powershell 查看更新的状态(例如:KB3035583)。我知道有一些方法可以做到这一点,但我不知道其中任何一种。