# Tag Info

0

I have found the answer: $oldpw = "oldpassword"$newpw = "newpassword" $user =$env:username $computer =$env:computername $user = [adsi]"WinNT://$computer/$user"$user.ChangePassword($oldpw,$newpw) This worked for me. Thank you for your replies!

0

I don't have enough points here to change it, but this question looks like a duplicate of this one.

0

The bash variable $EUID shows the effective UID the script is running at, if you want to make sure the script runs as root, check wether$EUID contains the value 0 or not: if [ $EUID -ne 0 ]; then echo "$0 is not running as root. Aborting." exit 2 fi This is better than the solution with /usr/bin/id (for bash scripts!) because it doesn't require ...

0

$root = 'C:\logs' Get-ChildItem -Path$root | Where-Object { $.name -match "^\d*$" -and $.LastWriteTime -lt (Get-Date).Adddays(-45) } | Remove-Item -Recurse -Force 0 I recommend using https://github.com/gsauthof/cgmemtime. cgmemtime measures the high-water RSS+CACHE memory usage of a process and its descendant processes. To be able to do so it puts the process into its own cgroup. For example process A allocates 10 MiB and forks a child B that allocates 20 MiB and that forks a child C that allocates 30 ... 1 Would love for this to be a comment - if only I had the rep. Would love even more for this to be a private message but apparently stackexchange doesn't and will not ever do those. SteadH: Wondering if you had any luck with this? I'm trying to do the same thing myself. I've used the tamperdata firefox plugin to see what happens during a login process (i.e. ... 2 Easiest, native solution according to me. using powershell: Invoke-WebRequest http://your.url/path Save as test.ps1 and just invoke it. Then schedule it using task scheduler. 0 Here is an example of how I do this: file { [ '/sys/block/sda/queue/scheduler', '/sys/block/sdb/queue/scheduler', '/sys/block/sdc/queue/scheduler', '/sys/block/sdd/queue/scheduler', '/sys/block/sde/queue/scheduler', '/sys/block/sdf/queue/scheduler' ]: ensure => 'file', content => ... 0 You need to use the || or syntax for this if [ "$HOSTNAME" == 'server1.domain.com' ] || [ "$HOSTNAME == 'server2.domain.com'"] then do something else dont' do something fi if you want to check against a list of files then you could do something like this: echo -e "computer1\ncomputer2\nmycomputer" > computerfile hostname=mycomputer if grep ... 0 To run the postrotate script only once (when defining a logrotate entry on multiple files) add the sharedscripts option 2 You can easily copy the contents of a file over-the-wire through a PSRemoting session using Invoke-Command and Set-Content:$Session = New-PSSession -ComputerName "remotehost.domain.tld" -Credential (Get-Credential) -UseSsl $FileContents = Get-Content -Path 'C:\path\to\arbitrary.file' Invoke-Command -Session$Session -ScriptBlock { ...

1

Keep it simple. Diff returns 1 on difference and 0 on no difference. Use an if statement. This is how you can tell the difference between two files if diff file1 file2 > /dev/null then echo "No difference" else echo "Difference" fi To fix up YOUR problem (in which you are comparing the different between two variables in the example above use ...

3

You can also use cmp. From the man page - cmp - compare two files byte by byte. It exits with 0 if the files match. if cmp -s "$oldfile" "$newfile" ; then echo "Nothing changed" else echo "Something changed" fi

0

I can't follow your code, but the command I typically use is cd $DIR_WITH_ONE_FILE if (cd$DIR_WITH_OTHER_FILE ; md5sum $FILE) | md5sum -c --status then echo "same" else echo "different" fi It depends on the two files having the same name but living in different directories. YMMV. 0 Could it be your first variable contains the command as string, not its return value. I think you forgot the ` around the command in variable 1. 0 It sounds like Geo's specific problem has already been solved, but I ran into a similar message while trying to set up a Rails app with sidekiq as a managed service. I'll explain my solution here in case it helps any other newbies like me. I'm working on a CentOS install, and chkconfig is already set up with several other services like httpd, mysql, and ... 2 You don't need the intermediate myvar variable. If you want it, then simply substitute %myvar% for %1 below. You need two rounds of expansion. Option 1 - CALL @echo off call echo %%%1%% In the first parsing phase %% expands to % %1 expands to JAVA_HOME %% expands to % In the CALL phase, %JAVA_HOME% expands to the value you are looking for. Option 2 ... 1 Gmail strips out the style tags. You will need to put your style inline. It will probably be easiest to perform string manipulation on$Report. For example: $newhtml =$Report -replace ('<td','<td style="color:red;"')

3

It's really simple as you describe it: for k in {50..99}; do echo ip dhcp-relay 10.32.1$k.129 10.32.$k.1 enable; done > pastethisinswitch.txt but it will only scale up to 99 that way. You can scale it up to 254 like so: for k in {50..154}; do echo ip dhcp-relay 10.32.$(expr 100 +$k).129 10.32.\$k.1 enable; done > pastethisinswitch.txt Your ...

Top 50 recent answers are included