none
need kind help on a powershell script RRS feed

  • Question

  • Hello All,

    I am new to this forum. need you kind help on a powershell script.

    Actually my requirement is to get the the DWORD of enablesecuritysignature and requiresecuritysignature from lanmanserver and lanmanworkstation of 2008 windows servers.

    I want to prepare a script to get the desired result for no of servers.

    can you please help. on googling out find out some like :

    $Servers = get-content c:\list.txt
    foreach($server in $servers)
    {
     Get-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters"  | select enablesecuritysignature*,requiresecuritysignature*, $Servers |

    fl
     }

    but not giving the actual dword value . Please help

    Tuesday, August 15, 2017 10:46 PM

Answers

  • You cannot use Get-ItemProperty remotely.  It is a local only provider.

    To correctly use the provider you must query specific properties by returning  a remote session:

    $servers |
    	ForEach-Object{
    	Invoke-Command -ScriptBlock {
    		Get-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters} -ComputerName $_
    	} |
    	Format-Table PsComputerName,EnableSecuritySignature, RequireSecuritySignature
    


    \_(ツ)_/

    • Marked as answer by joydeep212008 Wednesday, August 16, 2017 5:09 AM
    Tuesday, August 15, 2017 11:06 PM

All replies

  • You cannot use Get-ItemProperty remotely.  It is a local only provider.

    To correctly use the provider you must query specific properties by returning  a remote session:

    $servers |
    	ForEach-Object{
    	Invoke-Command -ScriptBlock {
    		Get-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters} -ComputerName $_
    	} |
    	Format-Table PsComputerName,EnableSecuritySignature, RequireSecuritySignature
    


    \_(ツ)_/

    • Marked as answer by joydeep212008 Wednesday, August 16, 2017 5:09 AM
    Tuesday, August 15, 2017 11:06 PM
  • Perfect sir..... !!!!!!!!!!!!!!!!!!!!!!!!!!

    Many Many Thankssssssssssssssssssssss

    Wednesday, August 16, 2017 5:09 AM