One of the easiest things to do in OS X is to remotely run an installation package using the installer command. You can do some similar tasks in Windows, although the commands aren’t quite as cut and dry. The Start-Process command can be used to kick off an executable. Here, we will kick off the msiexec.exe and feed it an argument, which is the msi file to install silently. We’ll then wait for it to complete: {Start-Process -FilePath "msiexec.exe" -ArgumentList "/i TEST.msi /qb" -Wait -Passthru}
-
-
Package Manager Like apt-get For Windows 10
In Windows 10, Microsoft has finally baked a package manager called OneGet into Windows. It works similarly to apt-get and other package managers that have been around for decades in the Linux world; just works in PowerShell, rather than bash. So let’s take a quick peak. First, import it as a module from a PowerShell prompt: Import-Module -Name OneGet Next, use Get-Command to see the options for the OneGet Module: Get-Command -Module OneGet This will show you the following options: Find-Package Get-Package Get-PackageProvider Get-PackageSource Install-Package Register-PackageSource Save-Package Set-PackageSource Uninstall-Package Unregister-PackageSource Next, look at the repositories of package sources you have: Get-PackageSource You can then add a repo to look at,…
-
Kill Windows Processes In Windows 8
You can gracefully stop Windows processes using the Stop-Process command let. For example, to stop Chrome: Stop-Process -Name Chrome Or to stop it by ID. To locate the ID of a process, use get-process: get-process Chrome You can then use the -ID operator to stop the process: Stop-Process -ID 6969 Kill is a command that all Mac and Unix admins know. It’s similar to Stop-Process, except it’s anything but graceful. And you use the -processname option to stop a process: kill -processname calc
-
Enable AutoAdminLogon For Windows Deployments
There are 3 registry keys that admins in the Windows world use to enable automatic logins, often required for deployments that require a logged in user to setup user environments, such as configuring app deployments as part of a mass deployment. The required keys in the registry are:
-
Get The Current Logged In User From The Windows Command Line
You can get the currently logged in user from a powershell script by using $env:username. But most deployment scripts use elevated privileges. Therefore, you need to be a tad bit craftier.
-
Yosemite Server SMB and Windows
A few people have hit me up about issues getting Windows machines to play nice with the SMB built into Yosemite Server and Windows. Basically, the authentication dialog keeps coming up even when a Mac can connect. So there are two potential issues that you might run into here. The first is that the authentication method is not supported. Here, you want to enable only the one(s) required. NTLMv2 should be enabled by default, so try ntlm: sudo serveradmin settings smb:ntlm auth = "yes" If that doesn’t work (older and by older I mean old as hell versions of Windows), try Lanman: sudo serveradmin settings smb:lanman auth = “yes" The second…
-
Use Syslog on Windows
There are a number of tools available for using Syslog in a Windows environment. I’ll look at Snare as it’s pretty flexible and easy to configure. First download the snare installation executable from http://sourceforge.net/projects/snare. Once downloaded run the installer and simply follow all of the default options, unless you’d like to password protect the admin page, at which point choose that. Note that the admin page is by default only available to localhost. Once installed, run the “Restore Remote Access to Snare for Windows” script. Then open http://127.0.0.1:6161 and click on Network Configuration in the red sidebar. There, we can define the name that will be used in syslog (or leave…
-
Change Active Directory Forest Mode With A Script
Changing the Forest Mode in Active Directory can be scripted. I find this useful when regression testing such tasks in a sandbox (e.g. restore image, automate login, change mode, run tests, etc). The script is very simple. First, you’ll import he ActiveDirectory modules: Import-Module -Name ActiveDirectory Then you’ll check for the mode prior to running: Get-ADForest | Format-Table ForestMode Then you’ll change the forest and domain modes (one per line): Set-ADForestMode –Identity “krypted.com” –ForestMode Windows2008Forest Set-ADDomainMode –Identity “krypted.com” –DomainMode Windows2008Domain Then you’ll report the result: Get-ADForest | Format-Table Name , ForestMode The end result could be as simple as three lines if just testing: Import-Module -Name ActiveDirectory Set-ADForestMode –Identity “krypted.com”…
-
Create A Server 2012 VM In VMware Fusion
Our friends at VMware continue to outdo themselves. The latest release of Fusion works so well with Windows Server 2013 that even I can’t screw it up. To create a virtual machine, simply open VMware Fusion and click New from the File menu. Click “Choose a disc or disc image.” Select your iso for Server 2012 and click on Open (if you have actual optical media it should have skipped this step and automatically sensed your installation media). Click Continue back at the New Virtual Machine Assistant screen. Click Continue when the Assistant properly shows the operating system and version. Enter a username, password and serial number for Windows Server…
-
Edit Windows Hosts File
Pretty much every operating system has a hosts file. In that file, you can define a hostname and then set a target IP. In Windows, that file is called hosts.txt and located in %systemroot%\system32\drivers\etc\. By default, that %systemroot% is going to be C:\Windows. This makes the path to the file C:\Windows\system32\drivers\etc\hosts.txt. By default, you’ll see the following: 127.0.0.1 localhost loopback ::1 localhost When you edit the file, add a new line with the IP address then a tab then the hostname that you’d like to be able to ping to get the address in question. For example, to add server.krypted.com to point to 192.168.210.210, you’d add some lines to make…