powershell

deleting certs from the “other people” certificate store

与世无争的帅哥 提交于 2021-02-07 10:28:59
问题 I have been doing some research to see if there is a way to script this functionality and I cant seem to find where these certs are actually stored. I see the other articles on "deleting certificates from store", but I think these are causing me more confusion. If I run a search like get-childitem -path cert:\CurrentUser , I don't see the Other People location. But, I am able to see the location in certmgr.msc . I have also checked the reg locations outlined here: https://technet.microsoft

deleting certs from the “other people” certificate store

孤街浪徒 提交于 2021-02-07 10:28:12
问题 I have been doing some research to see if there is a way to script this functionality and I cant seem to find where these certs are actually stored. I see the other articles on "deleting certificates from store", but I think these are causing me more confusion. If I run a search like get-childitem -path cert:\CurrentUser , I don't see the Other People location. But, I am able to see the location in certmgr.msc . I have also checked the reg locations outlined here: https://technet.microsoft

Can't seem to use generic collection with a PowerShell class

白昼怎懂夜的黑 提交于 2021-02-07 10:14:36
问题 I'm trying to invoke the List[T](IEnumerable) directly adding an item to the initial List like so, where T is a PowerShell class I've written (the below example uses the class name Thing : $someObject = Get-Thing # returns a single object $list = [List[Thing]]::new(@( $someObject )) However, this yields an error suggesting it can't find the overload for this constructor: Cannot find an overload for "List`1" and the argument count: "1". Setting List[T] to the Object class works, however:

How to sign and encrypt a message using S/MIME in PowerShell

点点圈 提交于 2021-02-07 10:12:35
问题 I am attempting to create a PowerShell script that will: Build a message Sign the message using my private S/MIME certificate Encrypt the message using the S/MIME public cert of the recipient Send the email that has been signed and encrypted I have included the full script below but changed email addresses, cert names, etc. The private cert has been imported onto the machine using Internet Explorer. It is then referenced within the directory C:\Users\xxx\AppData\Roaming\Microsoft

How to sign and encrypt a message using S/MIME in PowerShell

依然范特西╮ 提交于 2021-02-07 10:06:03
问题 I am attempting to create a PowerShell script that will: Build a message Sign the message using my private S/MIME certificate Encrypt the message using the S/MIME public cert of the recipient Send the email that has been signed and encrypted I have included the full script below but changed email addresses, cert names, etc. The private cert has been imported onto the machine using Internet Explorer. It is then referenced within the directory C:\Users\xxx\AppData\Roaming\Microsoft

Parent PowerShell Console Seems to Control Child PowerShell Console I/O

北战南征 提交于 2021-02-07 09:51:49
问题 $PSVersionTable output is Name Value ---- ----- PSVersion 5.1.18362.628 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.18362.628 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 [System.Environment]::OSVersion.Version output is Major Minor Build Revision ----- ----- ----- -------- 10 0 18363 0 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe started as a user who is a member of the local

Parent PowerShell Console Seems to Control Child PowerShell Console I/O

丶灬走出姿态 提交于 2021-02-07 09:50:15
问题 $PSVersionTable output is Name Value ---- ----- PSVersion 5.1.18362.628 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.18362.628 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 [System.Environment]::OSVersion.Version output is Major Minor Build Revision ----- ----- ----- -------- 10 0 18363 0 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe started as a user who is a member of the local

Retry attempts on failure when installing scheduled task with PowerShell

眉间皱痕 提交于 2021-02-07 09:30:39
问题 I am installing a scheduled task using a PowerShell script, but I would like it to retry 3 times on failure, how can I add this to my scheduled task registration script? $dropLocation = "C:\Tasks\" $Action = New-ScheduledTaskAction -Execute "$dropLocation\Task.exe" $Trigger = New-ScheduledTaskTrigger -Daily -At 10:15pm $Settings = New-ScheduledTaskSettingsSet -RestartCount:3 Register-ScheduledTask -Action $Action -Trigger $Trigger -TaskName "$taskName" -Settings $Settings -Description

Powershell default dropdown value

落爺英雄遲暮 提交于 2021-02-07 08:55:35
问题 I have a script where user selects choice from drop-down. But if a user doesn't select anything, I get error. How do I set a default value that is returned, even if user doesn't enter value. Here is script ######################## # Edit This item to change the DropDown Values [array]$DropDownArray = "c", "d", "share" # This Function Returns the Selected Value and Closes the Form function Return-DropDown { $script:Choice = $DropDown.SelectedItem.ToString() $Form.Close() } function selectShare

Powershell default dropdown value

99封情书 提交于 2021-02-07 08:54:41
问题 I have a script where user selects choice from drop-down. But if a user doesn't select anything, I get error. How do I set a default value that is returned, even if user doesn't enter value. Here is script ######################## # Edit This item to change the DropDown Values [array]$DropDownArray = "c", "d", "share" # This Function Returns the Selected Value and Closes the Form function Return-DropDown { $script:Choice = $DropDown.SelectedItem.ToString() $Form.Close() } function selectShare