powershell-4.0

Certain commands like IISRESET and ROBOCOPY have stopped working in Powershell v4

亡梦爱人 提交于 2021-02-20 04:35:27
问题 Certain commands like IISRESET and ROBOCOPY have stopped working in Powershell v4 I have a pretty large script that runs those 2 commands at certain points, but these now both give me the general error: iisreset : The term 'iisreset' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. These commands still work from CMD. The only changes that were made is

How to update a COM+ applications and create its msi file using PowerShell?

坚强是说给别人听的谎言 提交于 2021-02-10 17:55:43
问题 I have a COM+ application installed on my machine which has two components. This COM+ application was created using an SetupCom.exe file which was made using C# code some years bac. It used to install and create a COM+ msi file , but now I don't have access to that code, and I need to remove one component from this COM+ application - which is no longer in use. So, I searched using google and I found some PowerShell scripts that remove the components from the COM+ application, but they don't

Powershell SQL server database connectivity and connection timeout issue

给你一囗甜甜゛ 提交于 2021-02-07 20:52:04
问题 I've a powershell script connecting to SQL server 2012 database running a SQL query and result set into data table to send formatted email to relevant parties. Below is the code snippet where issue is: $CBA = New-Object System.Data.DataSet "CBAData" $sqlConn = New-Object System.Data.SqlClient.SqlConnection("Data Source=DataSource;Initial Catalog=DataCatalog;Integrated Security = False;Connection Timeout=800;User ID = user; Password =pwd;") $adapter = New-Object System.Data.SqlClient

Powershell SQL server database connectivity and connection timeout issue

*爱你&永不变心* 提交于 2021-02-07 20:51:38
问题 I've a powershell script connecting to SQL server 2012 database running a SQL query and result set into data table to send formatted email to relevant parties. Below is the code snippet where issue is: $CBA = New-Object System.Data.DataSet "CBAData" $sqlConn = New-Object System.Data.SqlClient.SqlConnection("Data Source=DataSource;Initial Catalog=DataCatalog;Integrated Security = False;Connection Timeout=800;User ID = user; Password =pwd;") $adapter = New-Object System.Data.SqlClient

Powershell SQL server database connectivity and connection timeout issue

假装没事ソ 提交于 2021-02-07 20:49:24
问题 I've a powershell script connecting to SQL server 2012 database running a SQL query and result set into data table to send formatted email to relevant parties. Below is the code snippet where issue is: $CBA = New-Object System.Data.DataSet "CBAData" $sqlConn = New-Object System.Data.SqlClient.SqlConnection("Data Source=DataSource;Initial Catalog=DataCatalog;Integrated Security = False;Connection Timeout=800;User ID = user; Password =pwd;") $adapter = New-Object System.Data.SqlClient

PowerShell Screen Capture

为君一笑 提交于 2021-02-04 06:50:45
问题 I have been stuck on this for last day or so and I think its something small that I just can't see. To summarize the code: Powershell script that will run every 60 seconds to take a screen capture. On Windows Server 2012 this works perfectly fine. While on Windows 7, only first screen shot is taken and then all after are "blank" with just white space the size of dimensions. Any Ideas why this happens? I also attempted to remove the bigger while loop and do a scheduled task that runs every 5

Robocopy with PowerShell : ERROR 3 (0x00000003) The system cannot find the path specified

别等时光非礼了梦想. 提交于 2021-01-29 14:48:21
问题 I have a PowerShell script for backup that I used on Windows 2003 Server for a long time, and now I have a problem with it on Windows Server 2012 R2. I have this message when I try to execute it: 2019/09/18 08:40:25 ERROR 3 (0x00000003) Creating Destination Directory Z:\BACKUP\D\ The system cannot find the path specified. I run the PowerShell script in PowerShell ISE as administrator or as a scheduled task with highest privileges. The script is executing on a server on a domain (DOMAIN1) that

PowerShell flattening nested JSON and convert it to CSV

╄→尐↘猪︶ㄣ 提交于 2021-01-29 14:38:13
问题 I have a JSON file below. I am trying to flatten and convert it to CSV. { "tempid": "template_86CE6E3BE3AD4EAB95727BCBFAD6A83C", "auid": "audit_00006F5D7A114CE59AD572E3E878E726", "created_at": "2017-01-12T08:54:48.835Z", "Dateat": "2019-04-26T14:24:09.496Z", "Datefrom": { "score": 64, "duration": 1754, "space": { "device_id": "88888888888888", "owner": "John Paul" }, "header_items": [ { "item_id": "357085FF-B66A-4C28-B9D", "children": "66f7893245d45-ea77-0020" }, { "parent_id": "357949D",

Is it possible to extract / read part of a file within a zip using powershell?

梦想与她 提交于 2021-01-29 13:09:17
问题 I have a powershell 4.0 script that does various things to organise some large zip files across an internal network. This is all working fine, but I am looking to make a few improvements. One thing that I want to do is extract some details that are within an XML file within the ZIP files. I tested this on some small ZIP files by extracting just the XML which worked fine. I target the specific file because the zip can contain thousands of files that can be pretty large. This worked fine on my

Copy rename move files powershell

拜拜、爱过 提交于 2021-01-29 12:32:05
问题 After a short period of time I managed to create a script that copies from one server to another, after that it renames it with date and time and then it should move the files to another location. I keep getting an error, and I am not entirely sure what is happening $server2 = "C:\Users\nicolae.calimanu\Documents\A\" # UNC Path. $datetime = Get-Date -Format "MMddyyyy-HHmmss" $server3 = "C:\Users\nicolae.calimanu\Documents\C\" # UNC Path. foreach ($server1 in gci $server1 -recurse) { Copy-Item