Total Views

Friday, June 21, 2013

SCCM - Collection Query (Computers with IP address and last logged on username from a given collection)

select A.Name0,c.IPAddress0 as "IP ADDRESS",E.UserName0 as "Lastlogged user"
from v_R_System A inner join
v_FullCollectionMembership B on
A.ResourceID=B.ResourceID
Inner join v_GS_NETWORK_ADAPTER_CONFIGUR  C ON
A.ResourceID=C.ResourceID
Inner join v_GS_COMPUTER_SYSTEM E ON A.ResourceID=E.ResourceID
where CollectionID=@COLLID and C.IPEnabled0=’1′ and c.ipaddress0 !=’0.0.0.0′
group by A.Name0,c.IPAddress0 ,E.UserName0

Friday, May 3, 2013

Raspberry Pi - First Steps

After I started my first projects on my Pi I have decided to post a quick tutorial on how to set up initially your device.


Step One: Prepare Your SD Card

First things first, we need to prepare your SD card for the Raspberry Pi. This involves formatting it properly and putting Raspbian, the standard Raspberry Pi operating system, on it. The steps vary depending on whether or not you're on a Mac, Linux, or Windows PC, so just follow the instructions for your operating system below.

Windows
  1. Download the lastest version of Raspbian and unzip the .img file inside. (It's almost 500MB so it may take a little while to download.)
  2. Download Win32DiskImager and unzip the application (.exe file) inside.
  3. Insert your SD card into your Windows PC using a card reader.
  4. Open Win32DiskImager.exe, the application you just downloaded, by double-clicking on it. If you're running Windows 7 or 8, right click on it and choose "Run as Administrator" instead.
  5. If your SD card isn't automatically detected by the application, click on the drop-down menu at the top right (labeled "Device") and choose it from the list.
  6. In the image file section of the application, click the little folder icon and choose the Raspbian .img file you just downloaded.
  7. Click the Write button and wait for Win32DiskImager to do its thing. When it finishes, you can safely eject your SD card and insert it into your Raspberry Pi.
OS X
  1. Download the lastest version of Raspbian and unzip the .img file inside. (It's almost 500MB so it may take a little while to download.)
  2. Download RPi-sd card builder (be sure to pick the appropriate version for your installed version of OS X) and unzip the application.
  3. Insert your SD card into your Mac using a card reader.
  4. Open RPi-sd card builder. You'll immediately be asked to choose a Raspbian image. Choose the .img file you downloaded earlier.
  5. You'll be asked if your SD card is connected. Since we inserted it earlier, it is, so go ahead and click Continue. You'll be presented with SD card options. If you only have one inserted, you won't see anything else in the list and it'll be checked. If not, just check only the card you want to use and click OK.
  6. Enter your administrator password and click OK.
  7. You'll be asked if the SD card was ejected. This is supposed to happen, as the application needs to unmount it so it can perform a direct copy. Double-check that your SD card is no longer available in the Finder. DO NOT remove it from your USB port. When you're sure, click Continue.
  8. RPi-sd card builder finishes prepping your SD card, safely eject it and insert it into your Raspberry Pi unit.
RPi-sd card builder isn't an app so much as it's an Automator action that acts like one. Some people have reported issues using it, so if you run into problems just open up the Terminal app (Your Hard Drive → Applications → Utilities → Terminal) and follow the instructions for Linux.
Linux
  1. Download the lastest version of Raspbian and unzip the .img file inside. (It's almost 500MB so it may take a little while to download.)
  2. Open up your Linux terminal emulator of choice.
  3. Insert your SD card. If it mounts automatically, unmount it but make note of its location (e.g. /dev/disk2s1). Even though the card is unmounted, do not remove it from the reader
  4. In the command line, you're going to need to type a single line to copy the contents of the Raspbian .img file to your SD card. It'll look like this:

    sudo dd if=PATH_TO_IMG_FILE of=PATH_TO_SD_CARD_MOUNT_POINT bs=1m

    You'll need to replace PATH_TO_IMG_FILE with the path to the .img file and PATH_TO_SD_CARD_MOUNT_POINT with the path to the SD card mount point. (The bs=1m just specifies the byte size and you don't need to mess with it.) When you're done, the command should look something like this:

    sudo dd if=/Users/adachis/Downloads/2012-12-16-wheezy-raspbian.img of=/dev/disk2s1 bs=1m

    It's very important that you do not get this information wrong or you could end up writing Raspbian to the wrong disk and cause serious data loss. Be careful! When you're sure you've got everything right, press enter.
  5. You will be prompted for the root password (or your administrator password for those of you on OS X who are using this method). Type it and press enter.
  6. It'll take some time for the dd command to copy everything over to your SD card. While that happens, it'll probably look like the Terminal froze up. Don't worry, it's still working and will likely take longer than an average 2GB copy to an SD card (so be patient). When it finishes, the command prompt will return and your SD card will be ready. Eject it safely and stick it in your Raspberry Pi.

Step Two: Hook Up Your Raspberry Pi


Connecting everything to your Raspberry Pi is pretty easy. Start by connecting the HDMI cable from the unit to your television (or monitor). If you're using the analog composite video connection instead, connect it to your television (or monitor) and plug in a set of speakers to the 3.5mm audio jack. If you want your Raspberry Pi to connect to your network and/or the internet, use an Ethernet cable to connect it to your router. If you've set up a computer before, this should all seem familiar.
Finally, you need to connect your Raspberry Pi with a micro USB power adapter. As mentioned earlier, you need an adapter that can provide at least 700mA at 5V. Fortunately, you probably already have one. Many smartphone and tablet chargers utilize micro USB and provide 700mA at 5V (or more). You can find out by reading the small text on the plug and looking for the output section. (Note: it may say 0.7A (or higher) instead of 700mA.) When you have a compatible power adapter on hand, connect it to a micro USB cable and then connect that cable to the micro USB port on your Raspberry Pi unit. It'll turn on all by itself and you should see it boot for the first time.



Step Three: Configure Your Raspberry Pi



Once your Raspberry Pi boots for the first time you'll need to configure a few things. You'll know it's ready for you when you see a Raspi-config window with a pretty big list of settings. You can mess with the others if you feel so inclined, but the only thing you really need to do is expand the file system so you can use up all the space on your SD card. To do so, follow these steps:
  1. Select expand_rootfs (the second option) and press enter.
  2. Confirm that you want to expand the file system and let Raspbian do its thing.
  3. When you're returned to the configuration list, go all the way to the bottom and select the Finish option.
  4. It'll ask you if you want to reboot. Choose yes.
Your Raspberry Pi will reboot and take a little longer this time because it needs to expand the file system. After a about a minute you'll be asked to log in. You'll need to use the default username and password:
Username: pi
Password: raspberry

Once you've logged in, you've got yourself a working Raspberry Pi. Congratulations!

The New Toy - Raspberry Pi rev.B

I just received my new toy and can't wait to start playing with it :)

It is Raspberry Pi Model B with very interesting wooden case (both purchased from Amazon)




It is already up and running and I am starting my work on it :)
Will keep you posted on my progress with different projects.

Cheers,
Petar

Wednesday, October 10, 2012

WSUS: How to change the location where WSUS stores updates

You accomplish this move with the movecontent command of WSUSutil.exe, a command-line tool that is copied to the file system of the WSUS server during WSUS Setup. By default, Setup copies WSUSutil.exe to the following location:
WSUSInstallationDrive:\Program Files\Microsoft Windows Server Update Services\Tools

You must be a member of the local Administrators group on the WSUS server to use the movecontent command of WSUSutil.exe, and these operations can only be run from the WSUS server itself which must be a 32-bit platform.  You must also create the new path for local WSUS update storage prior to using WSUSutil.exe.

The movecontent command takes an optional -skipcopy parameter which enables you to change the location of local WSUS update storage without copying any files. To change the location of local WSUS update storage complete the following steps:
1. Click Start, and then click Run.
2. In the Open box, type cmd, and then click OK.
3. At the command prompt, navigate to the directory that contains WSUSutil.exe.
4. Type the following, and then press ENTER:
wsusutil.exe movecontent contentpath logfile [-skipcopy]

For example, if D:\WSUS1 is the new path for local WSUS update storage, D:\move.log is the path to the log file, and you wanted to copy the old files to the new location, you would type:
wsusutil.exe movecontent D:\WSUS1\ D:\move.log

Tuesday, October 9, 2012

SCCM - Collection Query (Computers with VS 2008 Installed)

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Name in (select distinct SMS_G_System_COMPUTER_SYSTEM.Name  from SMS_R_System  inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId  inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId  where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName like "%Visual Studio 2008%")

SCCM - Device Collection Query (Domain OU Membership)

select 
SMS_R_SYSTEM.ResourceID,
SMS_R_SYSTEM.ResourceType,
SMS_R_SYSTEM.Name,
SMS_R_SYSTEM.SMSUniqueIdentifier,
SMS_R_SYSTEM.ResourceDomainORWorkgroup,
SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.SystemOUName = "DOMAIN/OU"

Saturday, September 29, 2012

SCCM - SQL query (Find last logon user details of computers)

Select distinct
v_R_System.Netbios_Name0 AS "Computer Name",
v_GS_SYSTEM_CONSOLE_USER.SystemConsoleUser0 AS "Console User",
v_GS_SYSTEM_CONSOLE_USER.NumberOfConsoleLogons0 AS "Console Logons",
v_GS_SYSTEM_CONSOLE_USER.TotalUserConsoleMinutes0 AS "Total Minutes on Console",
v_GS_SYSTEM_CONSOLE_USER.LastConsoleUse0 AS "Last Console Use"
from v_R_System INNER JOIN
(SELECT
ResourceID,
SystemConsoleUser0,
NumberOfConsoleLogons0,
TotalUserConsoleMinutes0,
LastConsoleUse0,
ROW_NUMBER() OVER(PARTITION BY ResourceID ORDER BY LastConsoleUse0 DESC) AS Point
FROM
v_GS_SYSTEM_CONSOLE_USER) v_GS_SYSTEM_CONSOLE_USER
ON v_GS_SYSTEM_CONSOLE_USER.ResourceID = v_R_System.ResourceID
AND v_GS_SYSTEM_CONSOLE_USER.Point = 1
Order by v_R_System.Netbios_Name0


Description: This will get you the top console user info who logged in to the machines most recently.