Tagcommandline

Azure VPN – Change Local Site Public IP

If a Clients Local site public IP changes the VPN tunel betwen Azure and the Local Site will disconnect. To fix this do the following:

Connect to Azure using powershell and run the following command:

New-AzureRmLocalNetworkGateway -Name LocalSite -ResourceGroupName [ClientRG] -Location ‘northeurope’ -GatewayIpAddress ‘[Public wan IP 2.4.6.8]’ -AddressPrefix ‘[LAN IP Net 192.168.1.0/24’

 

(Change the RG and Public wan IP and the LAN IP Net to the correct settings)

Delete old files from commandline

To quickly run a command (like delete) on files older than X days in commandprompt:

forfiles -p “C:\folder\Subfolder” -s -m *.* -d (Number of days) -c “cmd /c (command) @PATH”

Number of days has to be negative for days in the past (for example -30 for 30 days old). Replace “command” with the command you want to run (like del or echo)  

Show hidden files in Mac OSX

Show hidden files
Start a Terminal windows
Type followinf commands:
defaults write com.apple.Finder AppleShowAllFiles TRUE
killall Finder

Hide hidden files
Start a Terminal windows
Type followinf commands:
defaults write com.apple.Finder AppleShowAllFiles FALSE
killall Finder

Remove Ask Toolbar Commandline

To remove the ask toolbar run the following line in a elevated command line window:
MsiExec.exe /qn /X{86D4B82A-ABED-442A-BE86-96357B70F4FE} /norestart

This will work for versions 1.15.9.0 and 1.15.15.0.

 

If you want to make a .bat file it can be usefull to kill browsers before you try to uninstall Ask Toolbar.

Here is a single liner to kill IE, Chrome and Firefox in one go. Just add this line befor the MsiExec line in the bat file and you are golden

taskkill /f /im iexplore.exe /im firefox.exe /im chrome.exe

Set passwords to never expire in office 365

First, Enable .net 3.5 on your system.

Then, Download and Install Microsoft Online Services Sign-In Assistant

Microsoft Online Services Sign-In Assistant 64-bit (BETA) – <a title=”Microsoft Online Services Sign-In Assistant 64-bit (BETA) – http://www.microsoft.com/en-my/download/details.aspx?id=39267

Then Download and install Microsoft Online Services Module for Windows PowerShell

Microsoft Online Services Module for Windows PowerShell 64-bit – http://g.microsoftonline.com/0BX10EN/423

Restart computer and start “Microsoft Online Services Module for Windows PowerShell”

Type the command:  Connect-MsolService

And in the dialog enter the credentials of your Office 365 administrator

To control if a password for a single user expires
Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires

To change the password policy to never expire for a single user
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $true

To change the password policy to never expire for all users at once
Type the command: Get-MsolUser | Set-MsolUser -PasswordNeverExpires $True

To control that the modifications have been applied
Type the command “Get-MsolUser | fl”

And if you need to apply password policy to users

To change the password policy to expire for a single user
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $false

To change the password policy to expire for all users at once
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $false

Reset SA password from Command Promt with OSQL

If SQL server is installed without an instance:
Start command promt as administrator and type the following:
osql -E
If SQL server is installed with an instance (IE. SQLExpress):
Start command promt as administrator and type the following:
osql -S (local)\SQLExpress -E
Then the following command:
sp_password NULL,’nytt passord’,’SA’
GO

How To Delete A Service

Works in (at least): Win7, 2008 Server, 2008 R2 Server.

sc delete [Service Name]

To find service name, right click on the service. In the top of the General Tab, the service name is located. Right click and copy.

Install Nagios NPRE client on Windows

download the client from: http://nsclient.org/nscp/downloads (choose the *.zip file) and extract it to c:program files%foldername%

Install the service from cmd:

c:program filesnsclient++-0.3.9-x64nsclient++.exe /install

Service NSClientpp installed…
NSClient++.cpp(233) Service installed!

then start the service with net start from cmd:

net start nsclientpp

The NSClientpp (Nagios) 0.3.9.322 2011-07-04 x64 service is starting.
The NSClientpp (Nagios) 0.3.9.322 2011-07-04 x64 service was started successfully.

 

Get SMTP adresses with CSVDE (commandline) in Exchange 2003

This one gives you username and primary Email address

csvde -f users.csv -r “(&(objectCategory=Person)(objectClass=user))” -l “sAMaccountname,mail”

 

This one gives you ALL email addresses connected to the user

csvde -f users.csv -d OU=SBSUsers,OU=Users,OU=MyBusiness,DC=Company,DC=no -r (mailnickname=*) -l “sAMaccountname,mail,proxyaddresses”

Install Telnet on Windows 2008 server Commandline

pkgmgr /iu:”TelnetClient”

Ref:


© 2019 IdefixWiki

Theme by Anders NorénUp ↑