如何更新自动化帐户中的模块文件?

时间:2020-11-10 13:38:16

标签: azure-powershell azure-automation

执行脚本时是否可以更新自动化帐户中的模块文件?

例如,我有以下代码片段来更新本地计算机中的模块文件。

$path = $env:USERPROFILE + "\Documents\WindowsPowerShell\Modules\**\*\Framework\Abstracts\**.ps1"
$item = Get-ChildItem -Path "$path"
$Content = Get-Content -LiteralPath $item.FullName

$newContent = ""
$Content | ForEach-Object {
if ( $_ -match 'response = ""')
{
"match"
$_ = $_.replace('response = ""', 'response = "y"')
}
$newContent += $($_ + "`r`n" )
}
Set-Content -Value $newContent -LiteralPath $item.FullName

是否可以在运行手册中运行上述脚本来更新自动化帐户模块?

如果没有,执行脚本时如何更新自动化帐户中的模块文件?

所有模块都存储在哪里?任何建议将不胜感激。

1 个答案:

答案 0 :(得分:0)

恐怕您不能在运行手册中运行以上脚本。如我们所见,您的路径包括您自己的环境变量和本地路径,而天蓝色无法识别。

对于Import custom modules,您可以通过以下三种方式查看此链接。

实际上,您可以直接在门户中配置模块。 导航到您的自动化帐户,在add_action( 'Vendor_details', 'display_author_name', 20 ); function display_author_name() { // Get the author ID (the vendor ID) $vendor_id = get_post_field( 'post_author', get_the_id() ); // Get the WP_User object (the vendor) from author ID $vendor = new WP_User($vendor_id); $store_info = dokan_get_store_info( $vendor_id ); // Get the store data $store_name = $store_info['store_name']; // Get the store name $store_url = dokan_get_store_url( $vendor_id ); // Get the store URL $vendor_name = $vendor->display_name; // Get the vendor name $address = $vendor->billing_address_1; // Get the vendor address $postcode = $vendor->billing_postcode; // Get the vendor postcode $city = $vendor->billing_city; // Get the vendor city $state = $vendor->billing_state; // Get the vendor state $country = $vendor->billing_country; // Get the vendor country // Display the seller name linked to the store printf( '<b>Seller Name:</b> <a href="%s">%s</a>', $store_url, $store_name ); } 下找到ModulesModules galleryenter image description here 单击所需的模块,例如Shared Resources。您将看到下面的页面。然后单击导入。 enter image description here