Search This Blog

Loading...

Wednesday, January 14, 2015

Run command in system context

Sometimes I need to test program, scripts and so on running in system context, just to see if its working.

For this I always use an old friend from sysinternals PSEXEC.

http://technet.microsoft.com/en-us/sysinternals/bb897553

So let start a command prompt as SYSTEM:

Use the command: psexec -s cmd.exe

image

First time you start PSEXEC you must accept License Terms or use the parameter –accepteula to suppress the display of the license dialog:

image

And now we have a command prompt in SYSTEM context where we can test for example our script to see if if works in SYSTEM context.

This would be nice to try before running it in a SCCM Task Sequence or a Scheduled Task running in SYSTEM context.

To prove that we actual are running as SYSTEM we can try the command whoami.

And as you can see here it should reply nt authority\system

image

Use the command EXIT to return to the original command prompt.

image

PSEXEC will also work remote so let try the same on a remote computer:

psexec \\RemoteComputer -s cmd.exe –accepteula

image

And lets see on which computer we are running on by using the command HOSTNAME:

image

Again use exit to return to your local system.

Tuesday, January 6, 2015

How long has this system been running

I often need a quick way to see how long a Windows box has been running, or actually when it was last restarted Smile

One way is to use the command net statistics workstation and find Statistics since:

image

And of course PowerShell is nowadays also an option:

Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime

Note that this requires PowerShell 3.0 and that the time is 2 seconds before the time from net statistics.

image

Friday, December 19, 2014

Globeteam er klar til endnu mere nyt blod

 

Nu er det jo heldigvis ved at være jul og tid til at takke alle for året, der er gået.

 

Tak til alle jer, der har besøgt min blog i løbet af det sidste år. Der er lige i øjeblikket omkring 20.000 side visninger om dagen.

 

Jeg håber at bare lidt af indholdet kan bruges af andre end mig selv J

 

I samme omgang synes jeg også, det er på sin plads at takke alle kunder, konsulenter og partnere, der på den ene eller anden måde har samarbejdet med Globeteam i år. Uden jer gik det jo slet ikke.

 

Vi er nu 30 dedikerede konsulenter i Infrastruktur gruppen, og vi har et mål om at vokse med yderligere 6 konsulenter til næste år.

 

Så hvis du arbejder med Infrastruktur på et af følgende områder: Citrix, VMware, Azure, Office 365 eller Microsoft generelt og samtidig er udadvendt og god til at skabe tilfredse kunder, så overvej om Globeteam ikke skulle være dit næste karriere trin. Se mere om vores forretnings model på http://globeteam.com/om-globeteam/unik-forretningsmodel/

 

Du er altid velkommen til at sende dit CV eller kontakte mig for en uformel snak.

 

Rigtig glædelig jul og godt nytår – vi ses derude i 2015.

Thursday, December 18, 2014

Changing Windows Login Screen Background

Sometimes I need to change the standard Login Screen background to for example a corporate logo.

Windows 7

We can easily do this from a SCCM task sequence during OSD.

First we need a jpg file with the image we want to use, this file must not be greater than 256 KB and called backgroundDefault.jpg

Next create a package with only the jpg file in SCCM.

Windows 7 will use our new background if we do these two steps in our task sequence:

First we create the registry value HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background\OEMBackground and set it to a dword value of 1.

Registry example:

image

We can do this using the command:

reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background /v OEMBackground  /t REG_DWORD /d 1 /f

SCCM Task Sequence example:

image

Then next we need to copy the file to the local Windows 7 installation, using the package with the jpg file:

image

File copied to the local folder:

image

Windows 7 login screen with custom background:

image

Windows 8

On windows 8 we can use Group policy Settings or a local policy.

Computer Configuration – Policies – Administrative Templates – Control Panel – Personalization – Force a specific default lock screen image

We can use a UNC path or a local path, if we are using a local file the file must of cause exist on the computer. Deploy this with the OSD task Sequence just like Windows 7.

image

Computer Configuration – Policies – Administrative Templates – Control Panel – Personalization – Prevent changing lock screen image

image

Settings enabled in the GPO:

image

 

Please note that Windows 8 requires Windows 8 and Windows Server 2012 cumulative update: November 2012 as explained here http://support.microsoft.com/kb/2787100/en-us

It also looks like Windows 8 must be activated before this will work.

Windows 8 lock screen with custom background:

image