Difference between revisions of "Powershell Create Object"
Jump to navigation
Jump to search
Michael.mast (talk | contribs) (Created page with "<ref>https://community.spiceworks.com/topic/718753-need-to-output-the-user-input-from-the-powershell-script-to-a-csv</ref> <pre> $FirstName = Read-Host "Enter your First Name"...") |
Michael.mast (talk | contribs) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
| + | ==Filesystem Security== | ||
| + | <ref>https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemaccessrule(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2</ref><ref>http://www.tomsitpro.com/articles/powershell-manage-file-system-acl,2-837.html</ref> | ||
| + | Let's create an access object that can be used to update an ACL from the get-acl cmdlet. | ||
| + | <pre> | ||
| + | $newrule=New-Object System.Security.AccessControl.FileSystemAccessRule($newname,$FileSystemRights,$InheritanceFlags,$PropagationFlags,$AccessControlType) | ||
| + | </pre> | ||
| + | ==Other Types== | ||
<ref>https://community.spiceworks.com/topic/718753-need-to-output-the-user-input-from-the-powershell-script-to-a-csv</ref> | <ref>https://community.spiceworks.com/topic/718753-need-to-output-the-user-input-from-the-powershell-script-to-a-csv</ref> | ||
| + | |||
<pre> | <pre> | ||
$FirstName = Read-Host "Enter your First Name" | $FirstName = Read-Host "Enter your First Name" | ||
Latest revision as of 15:22, 31 July 2018
Filesystem Security
[1][2] Let's create an access object that can be used to update an ACL from the get-acl cmdlet.
$newrule=New-Object System.Security.AccessControl.FileSystemAccessRule($newname,$FileSystemRights,$InheritanceFlags,$PropagationFlags,$AccessControlType)
Other Types
$FirstName = Read-Host "Enter your First Name"
$LastName = Read-Host "Enter your Last Name"
$Shift = Read-Host "Enter your shift"
$Exmerge = Read-Host "Enter the amount of Exmerges"
$MessageTrackers = Read-Host "Enter the amount of MessageTrackers"
New-Object -TypeName PSCustomObject -Property @{
FirstName = $FirstName
LastName = $LastName
Shift = $Shift
Exmerge = $Exmerge
MessageTrackers = $MessageTrackers
Date = $ConCurrent
} | Export-Csv C:\Users\Profile\Desktop\TestOutput_$((Get-Date).ToString('MM-dd-yyyy-hh-mm-ss')).csv -NoTypeInformation
- ↑ https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemaccessrule(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2
- ↑ http://www.tomsitpro.com/articles/powershell-manage-file-system-acl,2-837.html
- ↑ https://community.spiceworks.com/topic/718753-need-to-output-the-user-input-from-the-powershell-script-to-a-csv