cost 179 ms
為什么 PS AD 模塊中 Get-ADGroup 命令的 ProtectedFromAccidentalDeletion 屬性會在一台機器上返回 NullReferenceException?

[英]Why does the ProtectedFromAccidentalDeletion property on the Get-ADGroup command in the PS AD module return a NullReferenceException on one machine?

我有一個 PowerShell 腳本,它使用 Active Directory PowerShell 模塊(RSAT 的一部分)。 它在 PowerShell 7 的 Windows 10 機器上運行良好,但在 PowerShell 6 的 Windows Server 2019 VM 上,它返回 ...

Powershell:捕獲 WebRequest 響應與本機響應不同

[英]Powershell: Catching WebRequest Respose differs from Native Response

我在從 catch 塊內的異常中獲取相同數據時遇到了一點問題,而我沒有得到的數據。 在沒有 try/catch 塊的情況下調用 Microsoft Defenders ATP API 會呈現以下錯誤消息: 但是,當處於 catch 塊中時,無法捕獲該消息中有用的任何附加信息(特別是 {code":" ...

PowerShell 5.1、6 和核心之間有什么區別?

[英]What is the difference between PowerShell 5.1, 6, and core?

據我了解,PowerShell 6 和 Core 使用 .Net Core 框架並且是跨平台的,而 PowerShell 5.1 使用 .Net 框架。 據我了解,PowersSell Core 也沒有 5.1 那樣發達 你會建議我開始學習什么? 我還是一名高中生,想在 INFOSEC 工作。 我想 ...

阻止用戶使用 PowerShell 打開已經存在的程序

[英]Stop user from opening an already program using PowerShell

我想阻止用戶使用 PowerShell 在 Windows 中運行另一個已經運行的程序/服務實例。 例如:我打開了記事本,然后在幾分鍾的時間內我想禁用打開記事本的選項,因為它已經在運行。 到目前為止,我可以檢測程序是否打開,如果沒有,我可以為用戶打開它(附上代碼)。 但是,如何禁用用戶打開另一 ...

在一個JSON數組中,如何搜索ConvertFrom-Json返回的某條記錄?

[英]In a JSON array, how to search for a certain record returned by ConvertFrom-Json?

使用 Powershell 6 我可以下載 JSON 格式的文件: (並且keys數組中有更多記錄......) 我怎樣才能用kid = "SsZsBNhZcF3Q9S4trpQBTByNRRI"搜索記錄,然后返回它的x5c屬性? 以下是查找記錄的好方法(我對-expand感到困惑,它是否剝離外 ...

用戶在 azure 函數中分配的托管標識拋出值不能為空

[英]User assigned managed identity in azure functions throwing value cannot be null

我有一個使用 power shell 6.2 創建的 http post azure 函數。 它需要訪問 Azure Key Vault 才能檢索機密。 當我分配系統分配的托管標識時,它工作得很好。 但是,在使用用戶分配的托管標識執行時獲取附加錯誤。 到目前為止我所做的。 在 azure 托 ...

如何讓 winrm 默認使用 powershell 7 進行遠程會話

[英]how to get winrm to use powershell 7 for remote sessions by default

隨着 powershell 7 的發布,似乎是時候超越 ps 5.1,所以我已經在幾台服務器上安裝了它來試一試。 但是,當我使用 ps7 從我的電腦創建到這些服務器的會話時,我總是在遠程機器上運行 ps5.1。 輸出 5.1.17763.316。 任何想法如何讓遠程會話在默認情況下最好使用 7 ...

從響應中提取附件

[英]Extract attached file from response

根據Whitesource 文檔,響應頭將具有 我想提取那個 xslx 文件,但我不知道如何提取。 我試過在文件中寫入響應,但是,我得到的只是一堆二進制字符。 我還嘗試在寫入之前將響應轉換為 csv,但這也不起作用。 任何的想法? ...

如何使用 Get-ChildItem 打印特定父/子的文件?

[英]How do I print file for a specific parent/child using Get-ChildItem?

我可以使用 Get-ChildItem -Recurse 遞歸搜索目錄。 但沒有按預期獲得輸出。 也嘗試過 -Depth。 但沒有運氣。 文件夾結構如下: C:\\Users\\Documents\\Azure\\repo\\Templates\\directory* directory1 ...

將 Connect-SPOService 與 Powershell 6(核心版)一起使用

[英]Use Connect-SPOService with Powershell 6 (core version)

我正在嘗試連接到共享點環境,並且我想使用 Powershell 版本 6 來實現這一點。為什么? 最后,我想將 PS 命令放在 .net core 3 應用程序中。 據我所知,我不能在 .net core 中使用 PS5.1。 這是關於這個powershell腳本: 當我在默認的 PS 5.1 ...

-and 比較是單獨評估還是針對同一對象評估?

[英]Is -and comparison evaluated individually or against the same object?

我正在尋找兩個數組之間丟失的事件: $tc_records & $RelationshipEvents_array 。 兩個數組應該有相同的兩個條目。 A->B 和反向 B->A 的條目。 當我使用 -and 語句評估 RelationshipEvents 時,是否評估一個( ...

為什么使用 Start-MpScan 掃描 Powershell 中的單個文件比使用上下文菜單選項花費更長的時間?

[英]Why does scanning a single file in Powershell with Start-MpScan take longer than using the context menu option?

我目前正在編寫一個腳本來使用 Windows Defender 來掃描各種文件。 我已閱讀有關Microsoft Docs - StartMpScan的文檔,但是在嘗試掃描單個文件或文件夾時遇到了問題。 文檔規定我使用-ScanPath表示選擇性掃描,所以它看起來像這樣; Start-MpSca ...

導出 Csv 和數組對象

[英]Export-Csv and Array objects

我有一個 CSV,我想在數組 object 中處理它並作為另一個 CSV 導出。 但是,當我這樣做時,它不是復制數組的值,而是復制 object 的屬性。 如何解決這個問題? 編輯: 導致這種情況的代碼: 其中$data是存儲 import-csv 的 output 的數組。 ...

將 json 數組傳遞給 powershell 中的 function

[英]Pass json array to function in powershell

我有這個簡短的腳本,它顯示一個帶有行號的表格,並詢問用戶想要使用哪個 Azure 訂閱。 它工作得很好。 現在我想寫一點 function 來顯示表格並從中選擇一個項目,以便將其重用於其他選擇。 當我用$subChoice = GetChoice $subscriptions 'Choose su ...

在 Powershell 6.0 中設置變量默認值的優雅方式?

[英]Elegant way of setting default value for variable in Powershell 6.0?

我有以下內容,但看起來很笨重: 有沒有更好的方法來做到這一點? 我在這里看到了這個答案,但它並不完全“更好”。 只是想知道 6.0 是否帶來了任何改進? 我可能要處理大量的配置選項,所以它會變得相當混亂。 ...

代碼在 Powershell 5 中完美運行,但在 Powershell 6 中不能正常運行

[英]Code works perfectly in Powershell 5 but not in Powershell 6

我的任務之一是從文件列表中創建 ISO 映像。 我找到了 這個要點(根據作者的說法,代碼在公共領域)。 我的公司只使用 Powershell 6.2.2,這就是我必須處理的事實。 問題是代碼在 Powershell 5.1 中完美運行,但在 Powershell 6.2.2 中卻沒有! 它給了我以 ...

Invoke-Expression,並非所有輸出都返回到變量

[英]Invoke-Expression, not all output returned to variable

我在我的 PowerShell 腳本中使用了一些 GIT 命令。 大多數時候,我通過Invoke-Expression調用 GIT 命令,以便我,例如 可以解析輸出,或/和 將輸出轉發到日志記錄方法。 在某些 GIT 命令中,我認識到並非所有輸出都是通過Invoke-Expression返 ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM