Difference between revisions of "General Powershell Notes"

From Michael's Information Zone
Jump to navigation Jump to search
Line 4: Line 4:
 
<pre>
 
<pre>
 
$PSVersionTable
 
$PSVersionTable
 +
</pre>
 +
 +
==Import Excel Spreadsheets==
 +
<ref>https://blogs.technet.microsoft.com/heyscriptingguy/2015/11/25/introducing-the-powershell-excel-module-2/</ref>This will save the hassle of converting to CSV all the time.
 +
<pre>
 +
Install-Module ImportExcel
 +
 +
Import-Excel '.\test.xlsx' -StartRow 3
 
</pre>
 
</pre>
  

Revision as of 13:55, 10 August 2018

[1]

Powershell Version

[2]

$PSVersionTable

Import Excel Spreadsheets

[3]This will save the hassle of converting to CSV all the time.

Install-Module ImportExcel

Import-Excel '.\test.xlsx' -StartRow 3

NTFS Permissions

[4] [5]

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

Passing Passwords to PSSession

[6] 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