Tag Info

New answers tagged

1

The last 2 lines of BackupScript.ps1 are Write-Host "Press any key to close ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") Comment these out (or delete them) and scheduled jobs should complete and exit cleanly. If you really want the pause at the end, replace the last line with something like this to wrap a timeout around it (each sleep is 1 ...


4

By combining 2 scripts found somewhere online, I managed to figure it out. This is the script that did the job. #Accept input parameters Param( [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] [string] $Office365Username, [Parameter(Position=1, Mandatory=$true, ValueFromPipeline=$true)] [string] $Office365Password ) ...


0

To test an AD Object in general by DistinguishedName, you can use the following: [bool](Get-ADObject -Filter {DistinguishedName-eq "CN=Users,DC=domain,DC=local"}) Or, when you want to search by another property like samaccountname: [bool](Get-ADObject -Filter {sAMAccountname -eq "Administrator"}) Both will return only a boolean ($true or $false) and can ...


1

Try with: A=12;echo 'scale=2;'"$A / 5"|bc -l


4

Replace single quotes with double; because with single quotes $A in your equation is not expanded, rather considered as literally $A not 12 A=12 ; bc <<< "scale=2;$(($A/5))" 2 Also, inside $(()) to variable does not need to be specified as $A, just A will do, e.g. A=12 ; bc <<< "scale=2;$((A/5))" 2 Next, when doing $(()) you invoke ...


0

i was trying different scenerios and got the ans myself. If we will include Expect "" before sending the last command. so our code at the end will look like : . . . } Expect "" send "$command\r" interact Thanks all .. !! :)


2

You can optimize single table like this : mysqlcheck -u root -o database_name table_name e.g. this one will optimize table 'user' of 'mysql' database. $ mysqlcheck -u root -o mysql user mysql.user OK edit For case when you have hundreds of databases; you can script this procedure like table_name='api_log' ...


1

Take a look at the logins command. The -p flag displays users without passwords. Example usage: # logins -p You can also parse /etc/security/passwd and look for an empty password entry.


1

Variables get expanded if used in double "" quotes, and Bash treats everything starting with $ as a variable. Use single quotes '' instead. ssh will end with an exit code <> 0 if an error occurred. This is stored in $?


0

This was simple, I've changed the first line to this and everything works fine: $body = Get-mailbox | get-mailboxstatistics | sort-object totalitemsize –descending | Select-Object DisplayName,@{expression={$_.totalitemsize.value.ToMB()};label=”Mailbox Size (MB)”} | ConvertTo-Html | out-string The key point wast "Format-Table" doesn't play nice with ...


0

I use Runasspc by Robotronic.de. With it it you can create an encrypted script file and run it in command line. Unfortunately the official site (http://www.robotronic.de/runasspcEn.html) is not working properly at the time, so you cannot download it from there. However I found the runasspcen.zip (contains the executables and instructions) from here: ...


0

You can do this with Profiles. You can make a profile through Server.app's web interface. You can download Apple's Server.app from the App Store. Then you can script the install: sudo profiles -I -F /path/to/profile.mobileconfig Example Finder Payload: Example Restrictions Payload: More Info Here


0

I seem to succeed with to following calling script: #!/bin/zsh RED_="\033[31m" BLUE_="\033[34m" BLACK_="\033[0m" if [ $# -lt 1 ]; then echo "$0: Invoke a program/script only once at a time" echo "Syntax: $0 <program/script with parameters>" else if ps -Alf | grep "$*" | grep -v grep | grep -v $0 >/dev/null; then echo "$BLUE_\"$@\"$RED_ runs ...



Top 50 recent answers are included