Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
防止Powershell采用Windows资源管理器选项_Windows_Powershell_Zip_Windows Explorer - Fatal编程技术网

防止Powershell采用Windows资源管理器选项

防止Powershell采用Windows资源管理器选项,windows,powershell,zip,windows-explorer,Windows,Powershell,Zip,Windows Explorer,我不经常使用Powershell,但昨天需要从zip存档中提取一个文件。在这个过程中,我通过迭代zip anbd的内容来查找文件,并将文件的item Name属性与文件名abc.ps1进行比较 代码在本地运行,我对得到的结果很满意。 将代码推送到要在服务器上运行的部署环境,代码通知我它找不到abc.ps1。 进一步调查,我以自己的帐户登录服务器,而不是代码执行时使用的服务帐户。当我查看zip文件时,它正在查询,我可以看到该文件,但它的名称为abc。 我有xyz.txt和def.pdf,但ps1文

我不经常使用Powershell,但昨天需要从zip存档中提取一个文件。在这个过程中,我通过迭代zip anbd的内容来查找文件,并将文件的item Name属性与文件名abc.ps1进行比较

代码在本地运行,我对得到的结果很满意。 将代码推送到要在服务器上运行的部署环境,代码通知我它找不到abc.ps1。 进一步调查,我以自己的帐户登录服务器,而不是代码执行时使用的服务帐户。当我查看zip文件时,它正在查询,我可以看到该文件,但它的名称为abc。 我有xyz.txt和def.pdf,但ps1文件只是abc。我知道这是基于Windows资源管理器选项中的“隐藏已知文件类型的扩展名”选项

使用服务帐户登录服务器,取消选中此选项并重新运行脚本修复了所有问题,它能够基于name+ext对文件进行fid

有没有一种方法可以强制PS在运行时不考虑这些资源管理器选项


我目前正在考虑应用GPO来阻止任何系统启用此选项。

这听起来像是在转移视线。Powershell不使用资源管理器设置。请看一看:您是否已完成basename选项卡?我不认为这是一件事