powershell-remoting

How to get free physical memory of remote computer using PowerShell

六月ゝ 毕业季﹏ 提交于 2020-06-25 12:18:33
问题 I have this: (Get-WMIObject Win32_logicaldisk -computername computer).TotalPhysicalMemory to get size of physical memory installed on remote computer. How do I get the FREE memory of that computer? I've tried (Get-WMIObject Win32_logicaldisk -computername computer).FreePhysicalMemory and some other variants, but with no effect. Is there some list of possible "filters"? 回答1: Whenever you want to see all of the properties of an object, pipe it to Format-List * . Get-WmiObject Win32_LogicalDisk

How to get free physical memory of remote computer using PowerShell

浪尽此生 提交于 2020-06-25 12:07:50
问题 I have this: (Get-WMIObject Win32_logicaldisk -computername computer).TotalPhysicalMemory to get size of physical memory installed on remote computer. How do I get the FREE memory of that computer? I've tried (Get-WMIObject Win32_logicaldisk -computername computer).FreePhysicalMemory and some other variants, but with no effect. Is there some list of possible "filters"? 回答1: Whenever you want to see all of the properties of an object, pipe it to Format-List * . Get-WmiObject Win32_LogicalDisk

Powershell to get AD user disabled in the past 6 months?

僤鯓⒐⒋嵵緔 提交于 2020-06-17 09:59:26
问题 How to get the AD user that was disabled in the past 6 months and also the time stamp when it was disabled in dd/MM/yyyy format as.CSV file? Like using this Powershell https://docs.microsoft.com/en-us/powershell/module/addsadministration/get-aduser?view=win10-ps ? $paramhash=@{ UsersOnly = $True AccountDisabled = $True SearchBase = "OU=Employees,DC=globomantics,dc=local" } Search-ADAccount @paramHash | Get-ADuser -Properties Description,Department,Title,LastLogonDate,WhenChanged | sort

Enter-PSSession is not working in my Powershell script

六眼飞鱼酱① 提交于 2020-01-31 06:07:51
问题 When I run the lines below from a script the file ends up being created on my local machine. $cred = Get-Credential domain\DanTest Enter-PSSession -computerName xsappb01 -credential $cred New-Item -type file c:\temp\blahxsappk02.txt exit-pssession When I run each line individually from the powershell console the remote session is created correctly and the file is created on the remote machine. Any thoughts on why? Is it a timing issue is the script perhaps? 回答1: Not sure if it is a timing

Enter-PSSession is not working in my Powershell script

房东的猫 提交于 2020-01-31 06:07:29
问题 When I run the lines below from a script the file ends up being created on my local machine. $cred = Get-Credential domain\DanTest Enter-PSSession -computerName xsappb01 -credential $cred New-Item -type file c:\temp\blahxsappk02.txt exit-pssession When I run each line individually from the powershell console the remote session is created correctly and the file is created on the remote machine. Any thoughts on why? Is it a timing issue is the script perhaps? 回答1: Not sure if it is a timing

Running remote scripts in powershell

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-24 20:09:31
问题 I've successfully got winrm working and I'm able to run Enter-PSSession my-machine in the shell and subsequently enter commands. However, when I try to run a script that starts up a remote session, all subsequent calls are run on the local machine. For instance: PS> test.ps1 Contents of test.ps1 Enter-PSSession remote-pcname gc env:computername prints out local-pcname instead of remote-pcname any idea why the script file is not honoring the remote session? It is definitely successfully

Running remote scripts in powershell

自古美人都是妖i 提交于 2020-01-24 20:05:19
问题 I've successfully got winrm working and I'm able to run Enter-PSSession my-machine in the shell and subsequently enter commands. However, when I try to run a script that starts up a remote session, all subsequent calls are run on the local machine. For instance: PS> test.ps1 Contents of test.ps1 Enter-PSSession remote-pcname gc env:computername prints out local-pcname instead of remote-pcname any idea why the script file is not honoring the remote session? It is definitely successfully

Running remote scripts in powershell

社会主义新天地 提交于 2020-01-24 20:04:28
问题 I've successfully got winrm working and I'm able to run Enter-PSSession my-machine in the shell and subsequently enter commands. However, when I try to run a script that starts up a remote session, all subsequent calls are run on the local machine. For instance: PS> test.ps1 Contents of test.ps1 Enter-PSSession remote-pcname gc env:computername prints out local-pcname instead of remote-pcname any idea why the script file is not honoring the remote session? It is definitely successfully

Reading event log remotely with Get-EventLog in Powershell

拟墨画扇 提交于 2020-01-11 04:33:12
问题 I've a powershell script which runs on server(test-server) and reads the log file of his client(DC1). Both sides can ping to each other. On both sides, firewalls are disabled. Remote Desktop and Remote Assistance are enabled on DC1. Get-EventLog System -ComputerName test-server -Source Microsoft-Windows-Winlogon # WORKS Get-EventLog System -ComputerName DC1 -Source Microsoft-Windows-Winlogon # DOESN'T WORK I run this script on test-server. As you see when I read the local log file on test

How can I use PowerShell to make remote registry changes?

帅比萌擦擦* 提交于 2020-01-10 05:29:05
问题 I have tested the following PowerShell registry settings and it sets them correctly. Could someone show me the way to do this for a remote computer? New-Item -itemType String HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration\Server0ps -Value "MY.DOMAIN.COM" New-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\PermittedManagers -Name 1 -Value "whatever" Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities -Name