目前,我有一个4节点的S2D集群,我们将在几天内发送给我们的客户。 之前我需要执行一些存储基准testing,之前我find一篇关于压力testing的文章 – VM Fleet https://www.starwindsoftware.com/blog/deploy-vm-fleet-to-benchmark-your-storage-system 。 目前我试图让PowerShell使用VM Fleet脚本,但是得到 Windows PowerShell成功更新了您的执行策略,但是该设置被在更具体的范围内定义的策略覆盖 而且政策也没有改变。 我错过了什么吗? 另外,基准testing是在所有的集群节点上进行的,我怎样才能select例如3分之4?
我目前正在使用: $emailFrom = "[email protected]" $emailTo = "[email protected]" $subject = "subject" $body = "message" $smtpServer = "mail.host.com" $smtp = new-object Net.Mail.SmtpClient($smtpServer) $smtp.Send($emailFrom, $emailTo, $subject, $body) 我知道用下面的命令我可以find我所有的硬盘上的可用空间: Get-WmiObject WIN32_logicaldisk | sort -desc freespace | select -first 3 | format-table -autosize deviceid,devicetype,providername,freespace,size,volumename; 当我尝试这样做: $body = Get-WmiObject WIN32_logicaldisk | sort -desc freespace | select -first 3 | format-table -autosize […]
我正在pipe理一个networking,他们在这里使用几个脚本。 大多是批处理脚本或VBScript。 这是一个Windows环境,主要是Server 2008和less量的2003服务器。 我的问题是我应该学习VBscript和Powershell还是只是Powershell? 我想学习如何自动执行一些任务,甚至通过CLI执行pipe理,但是我不确定Powershell是否可以替代VBscript来处理大多数pipe理任务。
有没有一种方法,我可以透明地设置窗口上限,当特定的应用程序运行。 对于奖励积分,当应用程序终止时,我应该能够恢复正常(非大写模式)。 我GOOGLEsearch,经过SO / SF,但我甚至不知道从哪里开始find答案。 谢谢
在同一networking上安装了两台Windows 7机器。 我启用了所需的一切,以便他们可以与winrm沟通。 当我运行以下命令: Invoke-Command -ComputerName REMOTE-PC -ScriptBlock { Start-Process calc.exe } 它工作正常,但在远程机器上永远不会看到该程序。 据我所知,这是预期的行为。 我假设stream程正确启动,然后在会话结束时立即closures。 如何运行程序以使其显示在主机上?
我正在使用Get-DhcpServerv4Scope cmdlet,并且正在寻找使用-scopeid开关将多个作用域拉入variables。 Get-DhcpServerv4Scope -scopeid 10.1.0.0,10.1.1.0 但是,如果我这样做: $IP = "10.2.0.0,10.1.0.0" Get-DhcpServerv4Scope -scopeid $IP 我得到的错误: Get-DhcpServerv4Scope:无法处理参数'ScopeId'的参数转换。 无法将值“10.2.0.0,10.1.0.0”转换为键入“System.Net.IPAddress []”。 错误:“无法转换值”10.2.0.0,10.1.0.0“键入”System.Net.IPAddress“错误:”指定了无效的IP地址“ 任何人有一个想法如何得到这个转换? 编辑:这是我试图适应这个脚本的脚本。 我想有一个方法将这个脚本指向一个服务器,它重build所有范围。 现在我在一个制表符分隔的文件中输出范围,然后将它们复制并粘贴到Get-dhcpv4scope以将所有范围存储在一个variables中。 我打开任何build议: #GetScopes $ScopeExclusions = Get-DhcpServerv4ExclusionRange [string]$ScopesCSV=Get-DhcpServerv4Scope | Select ScopeID | convertto- csv -notypeinformation $ScopesCSV.replace('" ', ',').replace('"', '').replace('ScopeId,', '') | out-file c:\users\aturner\desktop\csv.txt **Copy contents from file to clipboard** $Scopes=Get-DhcpServerv4Scope -scopeid *PasteScopeCSVListHere* | select ScopeId,Name,Description,SubnetMask,StartRange,EndRange,LeaseDuration #Delete […]
我想创build一个维护脚本,在我们的每台服务器上运行,以清除常见的drop / archive目录。 优选地,脚本将使用文件夹path的参考文件和期望的老化限制。 然后,脚本会清理比老化限制更早的文件path。 input引用文件看起来像这样: c:\logs\iis\siteA\ 30 c:\logs\job1\ 60 e:\archive\clientA\ 90 第一个组件是文件path; 第二个是文件应保留的天数,用空格分隔。 现在为脚本我有以下; 然而,我的脚本经验令人尴尬。 (我更关注networking) #Attempted loop Foreach ($ParentDir = Get-Content .\paths.txt $arg1, $arg2) {$limit = (Get-Date).AddDays(-$arg2) $path = $ParentDir # Delete files older than the $limit. Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item […]
我有一个脚本用于自动化WSUS进程,最后一个阶段继续删除所有旧的/不必要的文件/对象。 我想在清理阶段之前提示'按'input'继续清除或任何其他键停止',以使人们不能运行它。 我现在在脚本末尾的代码在这里: Get-WsusServer 10.1.1.25 -PortNumber 8530 | Get-WsusUpdate -Classification All -Approval Unapproved -Status FailedOrNeeded | Approve-WsusUpdate -Action Install -Target $ComputerTarget -Verbose Write-Host "Updates have been approved!" Write-Host "Preparing to clean WSUS Server of obsolete computers, updates, and content files." #Part2 – WSUS Server Cleanup ##Run Cleanup Command Get-WsusServer $WSUS_Server -PortNumber $PortNumber | Invoke-WsusServerCleanup -CleanupObsoleteComputers […]
我们正尝试通过Powershell连接到远程服务器,并使用ActiveDirectory模块。 当试图在本地做到这一切,似乎一切正常。 PS C:\Users\bar> Import-Module ActiveDirectory PS C:\Users\bar> Get-ADUser 'baz' DistinguishedName : CN=Foo Baz,OU=baz.myhost.com,OU=FooMachine,DC=foo,DC=blah,DC=loc Enabled : True GivenName : Baz Name : Foo Baz ObjectClass : user ObjectGUID : <some guid> SamAccountName : baz SID : <more info here> Surname : Baz UserPrincipalName : baz@foo 当我们远程执行相同的操作时,我们并不那么幸运。 C:\> Enter-PSSession -ComputerName 172.1.2.3 -Credential foo\bar [172.1.2.3]: PS C:\Users\bar\Documents> […]
我们有一个/ tmp文件夹供人们用于临时性的东西。 它可以是任何文件和任何文件。 我们要这样做,以便自动删除(或最好是移动到同一个共享驱动器上的另一个文件夹)在过去两周内没有被访问过的所有文件。 这应该每周发生一次,我不必手动做。 有没有这样的软件? 任何人都可能有一个脚本? 服务器2008R2