具体来说,我试图获取输出,Get-OwaMailboxPolicy
并且我想将其添加到数组中,就像它打印到屏幕上一样(并完全扩展一些被截断的值...
),以便我可以从那里操作数据。
我已经用其他命令做过一千次了,我不确定为什么这个命令会给我带来这么大的困难?
无论是在云端还是在本地,这都应该是同样的问题。
get-owamailboxpolicy
答案1
枚举所有 PowerShell 输出属性值
看来您只需设置一下$FormatEnumerationLimit =-1
,然后当您运行命令时,输出属性值将不再被省略号截断...
。此-1
值将其设置为在 PowerShell 命令的显示输出中枚举无限数量的项目。
PowerShell 脚本(删除属性值截断)
$FormatEnumerationLimit =-1;
Get-OwaMailboxPolicy;
输出样本前
AllowedFileTypes : {.rpmsg, .xlsx, .xlsm, .xlsb...}
AllowedMimeTypes : {image/jpeg, image/png, image/gif, image/bmp}
ForceSaveFileTypes : {.vsmacros, .ps2xml, .ps1xml, .mshxml...}
ForceSaveMimeTypes : {Application/x-shockwave-flash, Application/octet-stream, Application/futuresplash, Application/x-director}
BlockedFileTypes : {.vsmacros, .msh2xml, .msh1xml, .ps2xml...}
BlockedMimeTypes : {application/x-javascript, application/javascript, application/msaccess, x-internet-signup...}
输出样例后
AllowedFileTypes : {.rpmsg, .xlsx, .xlsm, .xlsb, .tiff, .pptx, .pptm, .ppsx, .ppsm, .docx, .docm, .zip, .xls, .wmv, .wma, .wav, .vsd, .txt, .tif, .rtf, .pub, .ppt, .png, .pdf,
.one, .mp3, .jpg, .gif, .doc, .bmp, .avi}
AllowedMimeTypes : {image/jpeg, image/png, image/gif, image/bmp}
ForceSaveFileTypes : {.vsmacros, .ps2xml, .ps1xml, .mshxml, .gadget, .psc2, .psc1, .aspx, .wsh, .wsf, .wsc, .vsw, .vst, .vss, .vbs, .vbe, .url, .tmp, .swf, .spl, .shs, .shb, .sct,
.scr, .scf, .reg, .pst, .ps2, .ps1, .prg, .prf, .plg, .pif, .pcd, .ops, .mst, .msp, .msi, .msh, .msc, .mdz, .mdw, .mdt, .mde, .mdb, .mda, .maw, .mav, .mau,
.mat, .mas, .mar, .maq, .mam, .mag, .maf, .mad, .lnk, .ksh, .jse, .its, .isp, .ins, .inf, .hta, .hlp, .fxp, .exe, .dir, .dcr, .csh, .crt, .cpl, .com, .cmd,
.chm, .cer, .bat, .bas, .asx, .asp, .app, .adp, .ade, .ws, .vb, .js}
ForceSaveMimeTypes : {Application/x-shockwave-flash, Application/octet-stream, Application/futuresplash, Application/x-director}
BlockedFileTypes : {.vsmacros, .msh2xml, .msh1xml, .ps2xml, .ps1xml, .mshxml, .gadget, .mhtml, .psc2, .psc1, .msh2, .msh1, .aspx, .xml, .wsh, .wsf, .wsc, .vsw, .vst, .vss, .vbs,
.vbp, .vbe, .url, .tmp, .shs, .shb, .sct, .scr, .scf, .reg, .pst, .ps2, .ps1, .prg, .prf, .plg, .pif, .pcd, .osd, .ops, .mst, .msp, .msi, .msh, .msc, .mht,
.mdz, .mdw, .mdt, .mde, .mdb, .mda, .maw, .mav, .mau, .mat, .mas, .mar, .maq, .mam, .mag, .maf, .mad, .lnk, .ksh, .jse, .its, .isp, .ins, .inf, .htc, .hta,
.hpj, .hlp, .fxp, .exe, .der, .csh, .crt, .cpl, .com, .cnt, .cmd, .chm, .cer, .bat, .bas, .asx, .asp, .app, .adp, .ade, .ws, .vb, .js}
BlockedMimeTypes : {application/x-javascript, application/javascript, application/msaccess, x-internet-signup, text/javascript, application/xml, application/prg, application/hta,
text/scriplet, text/xml}
PowerShell 脚本(属性name:value
配对数组)
Get-OwaMailboxPolicy | %{$_.PSObject.Members | ?{$_.MemberType -eq "Property"} | %{"$($_.Name): $($_.Value)"}}
示例输出
AllowedFileTypes: .rpmsg .xlsx .xlsm .xlsb .tiff .pptx .pptm .ppsx .ppsm .docx .docm .zip .xls .wmv .wma .wav .vsd .txt .tif .rtf .pub .ppt .png .pdf .one .mp3 .jpg .gif .doc .bmp .avi
AllowedMimeTypes: image/jpeg image/png image/gif image/bmp
BlockedFileTypes: .vsmacros .msh2xml .msh1xml .ps2xml .ps1xml .mshxml .gadget .mhtml .psc2 .psc1 .msh2 .msh1 .aspx .xml .wsh .wsf .wsc .vsw .vst .vss .vbs .vbp .vbe .url .tmp .shs .shb .sct .scr .scf .reg .pst .ps2
.ps1 .prg .prf .plg .pif .pcd .osd .ops .mst .msp .msi .msh .msc .mht .mdz .mdw .mdt .mde .mdb .mda .maw .mav .mau .mat .mas .mar .maq .mam .mag .maf .mad .lnk .ksh .jse .its .isp .ins .inf .htc .hta .hpj .hlp .fxp
.exe .der .csh .crt .cpl .com .cnt .cmd .chm .cer .bat .bas .asx .asp .app .adp .ade .ws .vb .js
BlockedMimeTypes: application/x-javascript application/javascript application/msaccess x-internet-signup text/javascript application/xml application/prg application/hta text/scriplet text/xml
更多资源
-
-
确定显示中包含多少枚举项。此变量不会影响底层对象;只会影响显示。当的值
$FormatEnumerationLimit
小于枚举项的数量时,PowerShell 会添加省略号 (...
) 来指示未显示的项目。有效值:整数(Int32)
默认值: 4
-