ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Topics
    2. Tags
    3. cmd
    Log in to post
    • All categories
    • WrCombsW

      Remotely Update environment Variables in Windows 7?

      Watching Ignoring Scheduled Pinned Locked Moved Solved IT Discussion wrcombs environmentvariables windows7 cmd remote commands
      7
      0 Votes
      7 Posts
      859 Views
      WrCombsW

      @dashrender said in Remotely Update environment Variables in Windows 7?:

      @wrcombs said in Remotely Update environment Variables in Windows 7?:

      @dashrender said in Remotely Update environment Variables in Windows 7?:

      https://searchvirtualdesktop.techtarget.com/tip/Tips-for-running-PowerShell-against-remote-Windows-7-desktops

      Thanks !

      Looks like going on site is still required because I have no idea if IIS is already installed - my guess is it isn't.

      oh well, good information to have if I ever need it in the future.

      Yeah, if you're going on site - skip all this and just put on VNC.

      my thoughts exactly, But I figured if there was a way to do this without having to go on site, it would make it so much easier.
      guess I can mark this as solved.

    • gjacobseG

      How To: for files

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion windows 10 cmd forfiles delete older than
      9
      0 Votes
      9 Posts
      1k Views
      1

      @gjacobse said in How To: for files:

      That said, from what you are saying; is my ‘failure’ was omitting the /M which specifies the ‘searchmask’. And because of that omission, it didn’t have the comparative variable, and deleted everything.

      There were two things that tripped you up.

      The lack of /M to just find *.tmp files Using del *.tmp as the command

      First forfiles is a for-loop that executes whatever command you want for each file it finds.
      As @JasGot mentioned you will get one hit for each file it will find.

      With /D -15 you are specifying that you only want to find files older than 15 days.
      With /S you are telling forfiles to look in all subdirectories as well. You may or may not want that.
      With /M you can specify a filter which matching filenames you want to search for. Without /Mit will find all the files regardless if it's named 123.tmp or installation.txt

      Your initial command would find all files in all subdirectories regardless if it what name it had. That's why you needed /M.

      Secondly, forfiles will execute whatever command you want for each and every file it finds.
      Since your command was del *.tmp it would delete all tmp files every time it found a file.
      What you really wanted was to just delete the file it found.
      The @file will have the name of the file so del @file would only delete the file that was found.

    • scottalanmillerS

      Managing Windows Local Groups with Net LocalGroup

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion sam windows administration system administration scottalanmiller windows cmd net local groups user management
      6
      4 Votes
      6 Posts
      1k Views
      ObsolesceO

      I ran into a language issue the other day when writing a PowerShell script that uses net localgroup and thought it could be useful to others:

      Depending on the language your Windows device is set to, the local Administrators group will be different, so the typical net localgroup administrators domain\user /add command will fail.

      Implementing the following will grab the actual name of the group by it's SID first, then use that result.
      Note that this is written to work in PowerShell, not CMD.exe.

      # Gets the name of the local Administrators group in appropriate language $localAdminGroupName = (Get-WmiObject win32_group -filter "LocalAccount = $TRUE And SID = 'S-1-5-32-544'" | Select-Object -Expand name) Write-Output "Local Administrators group detected as: [$localAdminGroupName]" # Sets the users as a local admin using appropriate local Administrators group name net localgroup $localAdminGroupName domain\user /add # Gets local Administrators group members net localgroup $localAdminGroupName
    • scottalanmillerS

      Add a User to Remote Desktop Users in Windows Remotely

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion windows rdp remote desktop psexec windows server cmd sysinternals
      7
      3 Votes
      7 Posts
      8k Views
      scottalanmillerS

      @gjacobse said in Add a User to Remote Desktop Users in Windows Remotely:

      I seem to remember doing this via ScreenConnect CMD

      Only works if SC is installed, which if it was, we'd not need to do it 🙂

    • DustinB3403D

      Windows CLI - Find long Filepaths and compress to zip

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion windows command line compression file path file system long file name powershell cmd
      3
      2 Votes
      3 Posts
      610 Views
      gjacobseG

      Long file names can be a serious pain... for copy and backup reasons.

      I recall a NTG client that used a long name for the directories,.. and it made updating nearly impossible Should follow the KISS method... Directory names don't need to be 120 characters long,.. and four deep.

    • scottalanmillerS

      Rename Windows Hostname from Command Line

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion wmic powershell cmd windows windows 10 screenconnect
      9
      7 Votes
      9 Posts
      3k Views
      gjacobseG

      The batch file I have for one client is this:

      powershell Rename-Computer -NewName "COMPUTER_NAME" -DomainCredential DOMAIN\ADMINUser -Restart

      Where COMPUTER_NAME to not exceed the 15 character limit

      ETA:
      I should add that this batch script start with installing Chocolatey package management tools, then the default applications,

    • gjacobseG

      Understand CMD CLI to Powershell Variable

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion cmd cmdlet ps powershell chocolatey batch script scripting
      2
      0 Votes
      2 Posts
      1k Views
      dbeatoD

      @gjacobse So basically you want to iterate through a list of computers the same script correct? So do you have a list of computers? What are other steps on your script? because what we can do is the following

      *$computers = import-csv -Path "c:\script\computers.csv" foreach ($oldname in $computers){ Rename-Computer -NewName $newname -DomainCredential domain\admin -Restart}

      This assumes you have a CSV file with a oldname and new name columns with computer names.

    • scottalanmillerS

      Shutdown or Restart Windows from the CMD Command Line

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion windows command line cmd
      6
      1 Votes
      6 Posts
      2k Views
      gjacobseG
      @echo off setlocal :REQUEST set /p REQUEST="Logoff, Shutdown, Reboot or Abort? L/S/R/A " if /i %request%==l goto logoff if /i %request%==s goto timer if /i %request%==r goto timer if /i %request%==a goto abort goto REQUEST :logoff shutdown -f -l goto exit :abort shutdown -a goto exit :timer set /p TIMER="Wait how many seconds? " if /i %request%==s shutdown -f -s -t %timer% if /i %request%==r shutdown -f -r -t %timer% :exit
    • gjacobseG

      Windows Command Line Tools: System uptime

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion server watch cli cmd tools
      9
      2 Votes
      9 Posts
      2k Views
      gjacobseG

      @nadnerB said:

      It appears that you are running this via powershell and not cmd. Is that correct?
      (Just thought I'd double check)

      Yes via CMD

    • AmbarishrhA

      How to Enable Copy Paste Functionality in Windows CMD

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion tips cmd windows
      7
      3 Votes
      7 Posts
      2k Views
      DashrenderD

      @scottalanmiller said:

      @Carnival-Boy said:

      And what do you mean "this is done by default in Windows 10"? The Quick Edit mode isn't checked on my PC (and I don't understand why I would want it to be).

      That's odd, on by default here.

      Yep, just check in 1511, enabled here.

    • gjacobseG

      Windows CLI: List printers

      Watching Ignoring Scheduled Pinned Locked Moved Solved IT Discussion windows printers cmd cmdlet powershell
      6
      1 Votes
      6 Posts
      2k Views
      art_of_shredA

      Thanks! That's helpful.

    • 1 / 1