powershell

How to change the default directory of PowerShell in Anaconda Navigator?

荒凉一梦 提交于 2021-02-11 17:51:10
问题 I am using Anaconda Navigator version 1.9.12 for Windows 7, along with Python 3.7.6. I installed this recently to study Pytorch. In order to free up space in my C:\ drive, I created my main Pytorch folder in my D:\ drive at the address of : D:\Pytorch_folder\Pytorch However, every single time I open up Powershell Prompt through Anaconda, the default directory is always: C:\Users\Administrator Which happens to be the %HOMEPATH% environment variable. I've tried many suggestions in this question

Task scheduler / powershell / timeout

妖精的绣舞 提交于 2021-02-11 17:22:14
问题 I have a website which I need to run a script every hour. I set these parameters on task scheduler and it seems to work. Program/script: powershell.exe Add arguments: -c (new-object system.net.webclient).downloadstring('http://www.example.com/test.ashx') The problem is that I have a big loop and processes in this script and the script stops before it finish the loop! Is there any possibility to add a timeout as an argument or something else to prevent this? I'm using Windows Server 2008R2 and

Task scheduler / powershell / timeout

青春壹個敷衍的年華 提交于 2021-02-11 17:22:06
问题 I have a website which I need to run a script every hour. I set these parameters on task scheduler and it seems to work. Program/script: powershell.exe Add arguments: -c (new-object system.net.webclient).downloadstring('http://www.example.com/test.ashx') The problem is that I have a big loop and processes in this script and the script stops before it finish the loop! Is there any possibility to add a timeout as an argument or something else to prevent this? I'm using Windows Server 2008R2 and

Powershell ftp download failed

大憨熊 提交于 2021-02-11 16:51:31
问题 I'm having issues downloading files from an ftp in powershell, this script tries to setup the connection, search for some files (I got this part right) and then download it in the working directory, I got issues don't know why, please help!! Here's the code: #IP address of DNS of the target % protocol $protocol="ftp" $target = "XXXX" $connectionString = $protocol+"://"+$target #Method to connect $Request = [System.Net.WebRequest]::Create($connectionString) $Request.Method = [System.Net

How can i Filter “OU=Service account” from DistinguishedName in CSV file

江枫思渺然 提交于 2021-02-11 15:56:42
问题 i want this by import csv file and export to the file without the "ou=service account"....... 回答1: Your code is very close! The only thing is that the -notcontains operator is meant for finding elements in an array and should not be used on single strings. The same goes for -contains , -in , -notin . All of these work on arrays. What should work is using the -notmatch regex operator. Because this is regex, you should be aware that the string to search can hold characters that have special

TF Merge command in Powershell script task is not working

蓝咒 提交于 2021-02-11 15:56:23
问题 I am having powershell task with the following commands in my pipeline which is running using custom agent pool. $TFFile = "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe" $mergeCommand = " merge $/MyProject/dev $/MyProject/test /recursive" Start-Process "$TFFile" "$mergeCommand" $comment = "Automated merge check-in" $CheckinToTarget = " checkin $/MyProject/test /comment:$comment /recursive /noprompt"

how to print output of affected rows with powershell sqlserver smo assembly

若如初见. 提交于 2021-02-11 15:55:48
问题 Hi everyone i am new to powershell. im looking for a script that will print out the affected rows from an UPDATE,INSERT,DELETE tsql using smo assembly. i tried searching on the net and find some solution which is written from C#.. http://social.msdn.microsoft.com/Forums/sqlserver/en-US/eb9071c9-c8c2-47db-b660-2ad044af0ede/how-do-i-get-the-output-from-databaseexecutenonquery?forum=sqlsmoanddmo i dont know how to convert it to powershell. below is a powershell script that execute tsql update

Powershell - Delete files older dan x days but exclude folders

主宰稳场 提交于 2021-02-11 15:54:54
问题 I have found a script on the internet, I have edited a little bit but it's not working Using Powershell WS 2008 R2 Standard Script is : $del480 = "I:\CISS\Upload" Get-ChildItem $del480 -recurse *.* -force | where {$_.lastwritetime -lt (get-date).adddays(-480)} | Remove-Item -recurse What I need is to add 4 folders to this script, that has to be excluded for deleting -480 days. this are the folders: I:\CISS\Upload\_Atest I:\CISS\Upload\_Reporting I:\CISS\Upload\_Templates I:\CISS\Upload\

how to get the column headers for CSV data with Powershell?

帅比萌擦擦* 提交于 2021-02-11 15:49:13
问题 How can I get the column headers for CSV data? Here is the specific data: PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labsURL='http://www.bccdc.ca/Health-Info-Site/Documents/BCCDC_COVID19_Dashboard_Lab_Information.csv' PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labs_csv=Invoke-RestMethod -Method Get -Uri $labsURL -Headers @{"Content-Type" = "text/csv"} PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labs =

how to get the column headers for CSV data with Powershell?

坚强是说给别人听的谎言 提交于 2021-02-11 15:47:24
问题 How can I get the column headers for CSV data? Here is the specific data: PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labsURL='http://www.bccdc.ca/Health-Info-Site/Documents/BCCDC_COVID19_Dashboard_Lab_Information.csv' PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labs_csv=Invoke-RestMethod -Method Get -Uri $labsURL -Headers @{"Content-Type" = "text/csv"} PS /home/nicholas/powershell/covid> PS /home/nicholas/powershell/covid> $labs =