System.Security.SecurityException: 不允许所请求的注册表访问权。

本文介绍了一个批处理脚本,用于安装Microsoft Enterprise Library的各种模块作为Windows服务。这些模块包括缓存、配置、加密、数据访问、异常处理、日志记录和安全性应用块。脚本检查每个DLL是否存在,并使用InstallUtil工具进行安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

@SET InstallUtilPath=%windir%/Microsoft.NET/Framework/v1.1.4322/InstallUtil.exe

@ECHO.
@ECHO -----------------------------------------------------------------
@ECHO Installing Services for the Caching Application Block
@ECHO -----------------------------------------------------------------
@ECHO.
if Exist Microsoft.Practices.EnterpriseLibrary.Caching.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Caching.dll

@ECHO.
@ECHO -----------------------------------------------------------------
@ECHO Installing Services for the ConfigurationApplication Block
@ECHO -----------------------------------------------------------------
@ECHO.

if Exist Microsoft.Practices.EnterpriseLibrary.Configuration.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Configuration.dll

@ECHO.
@ECHO -----------------------------------------------------------------
@ECHO Installing Services for the Cryptography Application Block
@ECHO -----------------------------------------------------------------
@ECHO.

if Exist Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll

@ECHO.
@ECHO -----------------------------------------------------------------
@ECHO Installing Services for the Data Access Application Block
@ECHO -----------------------------------------------------------------
@ECHO.

if Exist Microsoft.Practices.EnterpriseLibrary.Data.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Data.dll

@ECHO.
@ECHO -----------------------------------------------------------------------
@ECHO Installing Services for the Exception Handling Application Block
@ECHO -----------------------------------------------------------------------
@ECHO.

if Exist Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll

@ECHO.
@ECHO ---------------------------------------------------------------------------------
@ECHO Installing Services for the Logging and Instrumentation Application Block
@ECHO ---------------------------------------------------------------------------------
@ECHO.

if Exist Microsoft.Practices.EnterpriseLibrary.Logging.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Logging.dll

@ECHO.
@ECHO -----------------------------------------------------------------
@ECHO Installing Services for the Security Application Block
@ECHO -----------------------------------------------------------------
@ECHO.

if Exist Microsoft.Practices.EnterpriseLibrary.Security.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Security.dll

@ECHO.
@ECHO ----------------------------------------
@ECHO InstallServices.bat Completed
@ECHO ----------------------------------------
@ECHO.
@PAUSE

 
PS C:\Users\at2zhange> "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name SetPolicyDrivenUpdateSourceForDriverUpdates -Value 0 >> Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name SetPolicyDrivenUpdateSourceForFeatureUpdates -Value 0 >> Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name SetPolicyDrivenUpdateSourceForOtherUpdates -Value 0 >> Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name SetPolicyDrivenUpdateSourceForQualityUpdates -Value 0 >> Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name DisableDualScan -Value 0 >> Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DoNotConnectToWindowsUpdateInternetLocations" -Type DWORD -Value 0 >> Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Servicing" -Name "RepairContentServerSource" -value 0 所在位置 行:1 字符: 59 + ... KLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name SetPoli ... + ~~~~~ 表达式或语句中包含意外的标记“-Name”。 所在位置 行:1 字符: 65 + ... dowsUpdate" -Name SetPolicyDrivenUpdateSourceForDriverUpdates -Value ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 表达式或语句中包含意外的标记“SetPolicyDrivenUpdateSourceForDriverUpdates”。 + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnexpectedToken PS C:\Users\at2zhange> Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name SetPolicyDrivenUpdateSourceForDriverUpdates -Value 0 >> Set-ItemProperty -Path Set-ItemProperty : 允许请求注册表访问权。 所在位置 行:1 字符: 1 + Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Win ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : PermissionDenied: (HKEY_LOCAL_MACH...s\WindowsUpdate:String) [Set-ItemProperty], Securit yException + FullyQualifiedErrorId : System.Security.SecurityException,Microsoft.PowerShell.Commands.SetItemPropertyCommand Set-ItemProperty : 缺少参数“Path”的某个参数。请指定一个类型为“System.String[]”的参数,然后再试一次。 所在位置 行:2 字符: 18 + Set-ItemProperty -Path + ~~~~~ + CategoryInfo : InvalidArgument: (:) [Set-ItemProperty],ParameterBindingException + FullyQualifiedErrorId : MissingArgument,Microsoft.PowerShell.Commands.SetItemPropertyCommand 这一段脚本为什么报错
07-03
Application: ASD880.exe CoreCLR Version: 9.0.24.52809 .NET Version: 9.0.0 Description: The process was terminated due to an unhandled exception. Exception Info: System.UnauthorizedAccessException: Access to the path is denied. at ASD880.View.SerialPortCommunication.SendDataAsync(Byte[] data) in C:\Users\asd\Desktop\充电头网PD31\ASD880\Page Navigation App\View\Communication.xaml.cs:line 59 at ASD880.View.BatteryMode.executePipeline(JArray jsonArray, Boolean PipeResult, Int32 frequency) in C:\Users\asd\Desktop\充电头网PD31\ASD880\Page Navigation App\View\BatteryMode.xaml.cs:line 1407 at ASD880.View.BatteryMode.ProjectStart_Click(Object sender, RoutedEventArgs e) in C:\Users\asd\Desktop\充电头网PD31\ASD880\Page Navigation App\View\BatteryMode.xaml.cs:line 890 at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at ASD880.App.Main() 分析错误
06-18
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值