Category : powershell

So I want to make a new windows service using a Powershell script that I wrote, that when run executes the powershell script. Here’s the command I want to run in order to make the service. New-Service -Name "TestService" -StartupType Manual -BinaryPathName ‘"c:pathtopowershellpowershell.exe -File C:ScriptsPowerShellScript.ps1"’ When I run this command the service gets successfully created, ..

Read more

What I want to achieve? great question, I want to copy the lastest file that was uploded to a Path directory and then copy it towards another path location for reporting purposes, the code I’m using to attemp accomplish this action is the next one: $Files = Get-ChildItem -Path "C:reposcriptsCopy move filessource*.*" -File -ErrorAction SilentlyContinue ..

Read more

I try to install Haskell with chcolatey. When I run choco install ghc it downloads ghc as expected. But at some point it says this: Access to the path ‘C:toolsghc-9.0.1-x86_64-unknown-mingw32’ is denied. Renamed C:toolsghc-9.0.1-x86_64-unknown-mingw32 to C:toolsghc-9.0.1 ERROR: Could not find a part of the path ‘C:toolsghc-9.0.1binghcii.sh’. The install of ghc was NOT successful. Error while ..

Read more

I am working with XML objects that require utf8 encoding. I’ve used $PSDefaultParameterValues[‘*:Encoding’] = ‘utf8’ but now I get teh below error. What is the correct way to use $PSDefaultParameterValues or how what does it need to work? Cannot index into a null array. At C:script.ps1:31 char:1 + $PSDefaultParameterValues[‘*:Encoding’] = ‘utf8’ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo ..

Read more

I am running this command using python: os.system(‘PowerShell -Command "Start-Process cmd -Verb RunAs"’) I would like to run a second command WITHIN the new command prompt that the command opens using python. However when I run any command, say echo hello it won’t use the cmd that was opened by the command before it. How ..

Read more