powershell

nrpe-check. send alarm if folder is modified

别来无恙 提交于 2021-01-07 02:32:57
问题 This below works fine for me. I wonder if someone could help me so that i can use it as a nrpe_check. If the directory modifies send out a alarm. Not sure how it works with nrpe. Looks like this script need's to be running all the time to fetch changes. So i have to start this script at first. Then another script for checking? Thanks in advance! ### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO $filewatcher = New-Object System.IO.FileSystemWatcher #Mention the folder to monitor

Windows batch/powershell file to regex find and replace only in files having specific text [closed]

那年仲夏 提交于 2021-01-07 02:31:45
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed yesterday . Improve this question How could I make a Windows batch file to find and rename with regex in files, that have specific text in them? This is the needed scenario: If file path is C:\Folder\ and file name is something_*.xml (wildcards allowed) and the file has specific text

Failing to install audio driver script using microsoft update as source on dell

大城市里の小女人 提交于 2021-01-07 02:19:08
问题 I am trying to run below code to install realtek audio driver on dell laptop but getting below error. Is it possible to use this script for all model laptop to install missing audio driver or update it? Any help would be greatly appreciated ERROR: RegistrationState ServiceID IsPendingRegistrationWithAU Service ----------------- --------- --------------------------- ------- 3 7971f918-a847-4430-9279-4a52d1efe18d False System.__ComObject Exception from HRESULT: 0x80240024 + $Downloader.Download

Failing to install audio driver script using microsoft update as source on dell

家住魔仙堡 提交于 2021-01-07 02:16:07
问题 I am trying to run below code to install realtek audio driver on dell laptop but getting below error. Is it possible to use this script for all model laptop to install missing audio driver or update it? Any help would be greatly appreciated ERROR: RegistrationState ServiceID IsPendingRegistrationWithAU Service ----------------- --------- --------------------------- ------- 3 7971f918-a847-4430-9279-4a52d1efe18d False System.__ComObject Exception from HRESULT: 0x80240024 + $Downloader.Download

Run Powershell command from different server

和自甴很熟 提交于 2021-01-07 01:44:01
问题 I have the following powershell command that reads and gives me the status of my .bat scripts depending on the content of .log files : Get-ChildItem *.log | ForEach-Object { [pscustomobject] @{ Name = $_.Name Status = ('FAILED', 'SUCCESS')[(Select-String -Quiet 'Finished with NO errors' $_.FullName)] } } This command runs perfectly, when running on the same server as the one where the .log files are stored (ServerA), however when running outside of it - no value is returned. Is there a way to

Run Powershell command from different server

霸气de小男生 提交于 2021-01-07 01:43:38
问题 I have the following powershell command that reads and gives me the status of my .bat scripts depending on the content of .log files : Get-ChildItem *.log | ForEach-Object { [pscustomobject] @{ Name = $_.Name Status = ('FAILED', 'SUCCESS')[(Select-String -Quiet 'Finished with NO errors' $_.FullName)] } } This command runs perfectly, when running on the same server as the one where the .log files are stored (ServerA), however when running outside of it - no value is returned. Is there a way to

How to use PowerShell to delete a single NAPTR record?

偶尔善良 提交于 2021-01-06 07:58:07
问题 I created a new NAPTR records using the GUI. However I'd like to delete one of them using PowerShell. I can prove there are 2 records: > Get-DnsServerResourceRecord -ZoneName "example.com" -Name "foo" -RRType naptr HostName RecordType Type Timestamp TimeToLive RecordData -------- ---------- ---- --------- ---------- ---------- foo NAPTR 35 0 01:00:00 foo NAPTR 35 0 01:00:00 > $OldObj = Get-DnsServerResourceRecord -ZoneName "example.com" -Name "foo" -RRType naptr > $OldObj[0].RecordData.Data

How to use PowerShell to delete a single NAPTR record?

大憨熊 提交于 2021-01-06 07:57:09
问题 I created a new NAPTR records using the GUI. However I'd like to delete one of them using PowerShell. I can prove there are 2 records: > Get-DnsServerResourceRecord -ZoneName "example.com" -Name "foo" -RRType naptr HostName RecordType Type Timestamp TimeToLive RecordData -------- ---------- ---- --------- ---------- ---------- foo NAPTR 35 0 01:00:00 foo NAPTR 35 0 01:00:00 > $OldObj = Get-DnsServerResourceRecord -ZoneName "example.com" -Name "foo" -RRType naptr > $OldObj[0].RecordData.Data

How to use PowerShell to delete a single NAPTR record?

故事扮演 提交于 2021-01-06 07:56:01
问题 I created a new NAPTR records using the GUI. However I'd like to delete one of them using PowerShell. I can prove there are 2 records: > Get-DnsServerResourceRecord -ZoneName "example.com" -Name "foo" -RRType naptr HostName RecordType Type Timestamp TimeToLive RecordData -------- ---------- ---- --------- ---------- ---------- foo NAPTR 35 0 01:00:00 foo NAPTR 35 0 01:00:00 > $OldObj = Get-DnsServerResourceRecord -ZoneName "example.com" -Name "foo" -RRType naptr > $OldObj[0].RecordData.Data

need to change file created date based on csv

谁都会走 提交于 2021-01-06 05:33:39
问题 Good evening everyone. I have been able to change date created attribute of a file using the following command $(Get-Item test1.html).CreationTime=$(Get-Date "11/24/2010 06:00 am") My problem is that I have 10000 files that need to have this done based on a csv file. CSV has two columns file name or and file created date. CSV and files are in same folder. How can I rename the files based on the corresponding date in column 2 eg. 1.pdf 2010/12/12 2.pdf 2011/13/01 3.pdf 1989/12/12 etc Thanks in