Giter VIP home page Giter VIP logo

psutils's People

Contributors

calinou avatar guillermooo avatar jetersen avatar joedf avatar kborowinski avatar kimbirkelund avatar lukesampson avatar pcriv avatar rasa avatar vidarkongsli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

psutils's Issues

sudo history

Hi guys. I have this issue: if i start a cmd window using sudo, the history of typed commands is gone. Any way to make it works? Thank you!

Sudo error when program tries to set console cursor position

To reproduce:

scoop cache rm cowsay
sudo scoop install cowsay --global

Error

Exception calling "SetCursorPosition" with "2" argument(s): "The handle is
invalid.
downloading https://github.com/lukesampson/cowsay-psh/archive/master.zip...done
"
At C:\Users\luke\appdata\local\scoop\apps\scoop\current\lib\install.ps1:70
#...
Exception calling "SetCursorPosition" with "2" argument(s): "The handle is
invalid.
creating shim for cowthink.ps1
"
At C:\Users\luke\appdata\local\scoop\apps\scoop\current\lib\install.ps1:84
cowsay (0.2013.07.19) was installed successfully!
char:2
+     [console]::setcursorposition($left, $top)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

Sudo fails running in PowerShell ISE

When running sudo in PowerShell ISE, I get an error like "Error processing arguments: To open multiple files, provide a single list of individual filenames that are separated by commas." followed by some syntax examples.

No problem running sudo in PowerShell. Have not tested other utils in this repo.

ln forces absolute directories

When I use ln, it creates the symbolic link using an absolute directory instead of relative.

Example:

cd C:\folder
mkdir test
ln -s test test2
dir /AL /S

Output:

04/24/2015  12:57 PM    <SYMLINKD>     test2 [C:\Folder\test]

The UAC dialog from sudo doesn't have focus

That really kills a console session. You're typing away and have to sudo something

PS> sudo foo

But the UAC dialog appears under your window or on your second monitor, not in focus. So you have to switch ALT+TAB or use the mouse to focus the window and either click or press ALT+Y.

Anyway, not sure if there's something you can do about it :)

wrong format of $d.tostring in runat

in runat scriptlet:

- $d.tostring("hh:mm")
+$d.tostring("HH:mm")

without this change every tasks scheduled before noon...
Quite bad bug because result echo is printed in correct format!

Maybe it does work in US locales PC {here in EU we have 24h locales time format),
but then powershell is broken (very stupidly).

timecmd InvalidOperation at tme.ps1:7

InvalidOperation: C:\Users\nguyenc\scoop\apps\psutils\current\time.ps1:7
Line |
   7 |  & $cmd @args
     |    ~~~~
     | The expression after '&' in a pipeline element produced an object that was not
     | valid. It must result in a command name, a script block, or a CommandInfo object.

~#@❯ $PSVersionTable

Name Value


PSVersion 7.2.0-preview.6
PSEdition Core
GitCommitId 7.2.0-preview.6
OS Microsoft Windows 10.0.21390
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Error running any command

Error running, for example:

sudo cmd.exe /c mklink flink .\foo.txt
The Win32 internal error "The handle is invalid" 0x6 occurred
while getting console output buffer information. Contact
Microsoft Customer Support Services.

touch fails when running in strict mode

Most of my scripts calls Set-StrictMode -Version Latest; initially, and I've noticed that touch fails in this mode:

Set-StrictMode -Version Latest; 
touch <file>

The property 'A' cannot be found on this object. Verify that the property exists.     
At ...\touch.ps1:45 char:4                          
+ if($opts.A) {                                                                       
+    ~~~~~~~                                                                          
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : PropertyNotFoundStrict                                  

This can either be fixed by not accessing hashtable contents as members, but using the indexer, or by calling Set-StrictMode -Off at the beginning of the file.

Hope you fix this as I love your tools :-) And I'd be happy to make a PR with the change you'd prefer.

sudo caught by AV

It seems that the sudo command gets caught by some antivirus programs.

Example from Bitdefender:
PowerShell tried to load a potentially malicious resource and was blocked.Your device is safe.

Do you know of any ways around this? (that isn't to put PowerShell on the exceptions list)

Piping stuff to sudo

It would be nice if we could do something as the following with sudo:

$ iwr -useb examplescript.com | sudo iex

gitignore util does not seem to work when piping console output to a file

I'm not 100% sure if this is an issue with gitignore or my bad powershell skills, but I thought I would just add this here because maybe it's an easy fix.

When I tried using the gitignore util with the powershell command gitignore python >> .gitignore the command produced the full python gitignore template but the template didn't seem to be recognised by git. One of the excluded directories in the template is /build yet whenever I did a git add . on a fresh repository the /build directory was always included.

However, if I copied the template from gitignore.io to a new .gitignore file then there was no issue and the build folder wasn't staged. So I wonder if this is a text encoding issue, because when I copy and pasted the .gitignore file works but when piped it doesn't. I also noticed that the command line tool on gitignore.io adds -Encoding ascii to their command

Here are the .gitignore files that I generated.
not_working.txt
working.txt

[sudo] Command is incorrectly parsed when calling a .NET function

When calling a .NET function, sudo will incorrectly pass the command to the administrator instance, removing some characters.

Steps to reproduce:

PS> sudo [Environment]::SetEnvironmentVariable('Path', $value, 'Machine')

ParserError:
Line |
   1 |  [Environment]::SetEnvironmentVariable Path, 'C:\Users\bruno\desktop\D …
     |                                        ~~~~
     | Unexpected token 'Path' in expression or statement.

sudo removed the parenthesis, as well as the quotes on Path, causing the command to be syntactically incorrect.

`sudo` does not work in PowerShell 6

sudo does not work in PowerShell 6.

Reproduce:

  • Install PowerShell 6 Core
  • Run sudo echo 1
  • Observe no UAC
  • switch command to something that would otherwise require Admin privilege
  • Observe command fails

Sudo fails when running from PowerShell prompt within ConEmu

Steps to reproduce

  • install sudo \
  • install ConEmu (https://conemu.github.io/)
  • open a PowerShell prompt inside ConEmu
  • run form example sudo nvm use x.x.x

Command fails with The Win32 internal error "The handle is invalid" 0x6 occurred while getting console output buffer information. Contact Microsoft Customer Support Services.

Running the same command from: 'native' PowerShell prompt and a cmd hosted in ConEmu works

non-standard

Most function did not adopt powershell standard:

  1. not using standard verbs (you can get via command Get-Verb)
  2. powershell function usually consists of - (like start-process, get-childItem)
  3. uses alias in script, this is not recommended, and the alias is possible to be removed in the future, see this thread: PowerShell/PowerShell#929

If you are willing to change all the these, I can create a pull request to change them.

shasum cannot process file that have space in its name

shasum.cmd script splits file name at spaces. For example

$ shasum.cmd "SlackSetup 64.exe"
shasum: SlackSetup: no such file
shasum: 64.exe: no such file

I installed it via scoop.

$ scoop which shasum.cmd
Not a scoop shim.
C:\Users\talha\scoop\shims\shasum.cmd

Doesn't work when the username has space in it

Just to be clear, it works fine so far using windows powershell, but it fails when switching to git bash (which is what i use almost always), and shows this error:
** Presuming my windows username is Lina Lina**

C:\Users\Lina : The term 'C:\Users\Lina' 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.
At line:1 char:1

  • C:\Users\Lina Lina\scoop\apps\sudo\current\sudo.ps1
  •   + CategoryInfo          : ObjectNotFound: (C:\Users\Lina:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

Access denied when using powershell command `Out-File` with `sudo`

PS> cd C:\Program` Files
PS> sudo Write-Output "aaa" | Out-File a.txt
Out-File: Access to the path 'C:\Program Files\a.txt' is denied.

I also tried
sudo 'Write-Output "aaa" | Out-File a.txt' and
sudo Write-Output "aaa" > a.txt and
sudo echo "aaa" > a.txt but still not work.

shasum.cmd cannot process file that have parenthesis in its file name

Please see the following output

 $ shasum.cmd -a 256 '.\calibre-portable-installer-2.85.1(1).exe'
You cannot call a method on a null-valued expression.
At C:\Users\talha\scoop\apps\shasum\current\getopt.ps1:28 char:6
+         if($arg.startswith('--')) {
+            ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

shasum: .\calibre-portable-installer-2.85.1: no such file

On the other hand shasum.ps1 works fine.

$ shasum.ps1 -a 256 '.\calibre-portable-installer-2.85.1(1).exe'
2aa21727a54b2081bd96c6961cf91f4f88cf4124f7bcc816c28f836c40d062b8 *.\calibre-portable-installer-2.85.1(1).exe

sudo breaks the shell after terminating a batch job with ctrl+c

When I start a batch job with sudo, terminating it will cause the shell to hang. It terminates but then the terminal gets all messed up, things are printed in the wrong place, keystrokes don't register anymore.

image

This happens too if you "sudo pwsh" and terminate a batch job started without sudo.

PowerShell 7.3.3, no profile

'sudo' ignores profile scripts?

I have my powershell profile in C:\Users\Username\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1. I added some custom functions and aliases there that need admin privileges which I can access without problems while running powershell as administrator and typing MyFunction but on non-elevated powershell sudo MyFunction doesn't even recognize the function name and throws error:

MyFunction : The term 'MyFunction' 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.
At line:1 char:1
+ MyFunction
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (MyFunction:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Boolean values are converted to strings

I noticed that if one of the $args is a boolean like $false it gets converted to a string and causes problems in some cmdlets.

> sudo Disable-NetAdapter -Name "Wi-Fi" -Confirm:$false
Disable-NetAdapter : Cannot convert 'System.String' to the type 'System.Management.Automation.SwitchParameter' required by parameter 'Confirm'.

> sudo powershell
# Disable-NetAdapter -Name "Wi-Fi" -Confirm:$false
# Enable-NetAdapter -Name "Wi-Fi" -Confirm:$false

shasum: no output when using --check option

When checking a file against a given hash:

shasum 'filename' --check '903b7256397ebf8c9ba566bba2830a531353281a'

nothing happens, not 'true' nor 'false' output.

Not quite sure if it's a bug or just me not using it right.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.