Difference between revisions of "General Powershell Notes"

From Michael's Information Zone
Jump to navigation Jump to search
Line 10: Line 10:
 
<ref>https://blogs.technet.microsoft.com/fieldcoding/2014/12/05/ntfssecurity-tutorial-1-getting-adding-and-removing-permissions/</ref>
 
<ref>https://blogs.technet.microsoft.com/fieldcoding/2014/12/05/ntfssecurity-tutorial-1-getting-adding-and-removing-permissions/</ref>
 
<pre>
 
<pre>
 +
Get-Command –Module NTFSSecurity
 
Get-NTFSAccess -path .\Contacts
 
Get-NTFSAccess -path .\Contacts
 
add-ntfsaccess -path .\contacts -account first.last -accessrights read
 
add-ntfsaccess -path .\contacts -account first.last -accessrights read
 
</pre>
 
</pre>
 +
 
==Passing Passwords to PSSession==
 
==Passing Passwords to PSSession==
 
<ref>http://web.archive.org/web/20160822030847/http://geekswithblogs.net/Lance/archive/2007/02/16/106518.aspx</ref> Convert to secure string then call from file. This following pulls from stdin as a secure string (converts what you type), then converts that to something (I'm still new to Microsoft's ways of doing things), then stores as a file.
 
<ref>http://web.archive.org/web/20160822030847/http://geekswithblogs.net/Lance/archive/2007/02/16/106518.aspx</ref> Convert to secure string then call from file. This following pulls from stdin as a secure string (converts what you type), then converts that to something (I'm still new to Microsoft's ways of doing things), then stores as a file.

Revision as of 12:47, 14 June 2017

[1]

Powershell Version

[2]

$PSVersionTable

NTFS Permissions

[3] [4]

Get-Command –Module NTFSSecurity
Get-NTFSAccess -path .\Contacts
add-ntfsaccess -path .\contacts -account first.last -accessrights read

Passing Passwords to PSSession

[5] Convert to secure string then call from file. This following pulls from stdin as a secure string (converts what you type), then converts that to something (I'm still new to Microsoft's ways of doing things), then stores as a file.

read-host -assecurestring | convertfrom-securestring | out-file C:\securestring.txt